let _defineConfig = { version: "${lib_version}" } let _defConfig = { /** * iframe / 嵌入场景下是否把调用转发到父页面的同名 SDK(postMessage)。 * - 'auto'(默认):处于子 frame 时 startScan 等走父页;onScanListener 仅注册在 iframe 内,识别结果由父页回传 * - 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); } }