Files
scan-code-jssdk/src/services/config.js
2026-05-02 13:40:28 +08:00

37 lines
960 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let _defineConfig = {
version: "${lib_version}"
}
let _defConfig = {
/**
* iframe / 嵌入场景下是否把调用转发到父页面的同名 SDKpostMessage
* - 'auto'(默认):只要处于子 frameparent !== window即转发含 startScan 等均走父页逻辑
* - true | 'on' | 'parent':在存在父 window 时强制转发
* - false | 'off' | 'local':始终在本页执行(子页自己要跑扫码时用)
*/
embedProxyMode: 'auto',
}
let _customConfig = {
}
export function getVersion() {
return _defineConfig.version;
}
export function getConfig(key) {
if (Object.prototype.hasOwnProperty.call(_customConfig, key)) {
return _customConfig[key];
}
if (Object.prototype.hasOwnProperty.call(_defConfig, key)) {
return _defConfig[key];
}
return undefined;
}
export function setConfig(config) {
if (config && typeof config == "object") {
Object.assign(_customConfig, config);
}
}