diff --git a/lib/apis.js b/lib/apis.js index 34bd0e0a84fbe118ed3b53c139d40733a82fc155..32f5d2f4140a8c8e84f7a3052cc5aff96e932ace 100644 --- a/lib/apis.js +++ b/lib/apis.js @@ -139,6 +139,7 @@ const device = [ 'checkIsSoterEnrolledInDevice', 'startSoterAuthentication', 'onThemeChange', + 'offThemeChange', 'onUIStyleChange', 'getSystemSetting', 'getAppAuthorizeSetting', diff --git a/src/core/service/api/device/theme.js b/src/core/service/api/device/theme.js index a6543ad66541b07a9d0aae94360cf5679666dc44..375f7e4983ce5537ade6ae6347b2e2dc124d1c48 100644 --- a/src/core/service/api/device/theme.js +++ b/src/core/service/api/device/theme.js @@ -23,6 +23,16 @@ export function onThemeChange (callbackId) { callbacks.push(callbackId) } +export function offThemeChange (callbackId) { + // 暂不支持移除所有监听 + if (callbackId) { + const index = callbacks.indexOf(callbackId) + if (index >= 0) { + callbacks.splice(index, 1) + } + } +} + // 旧版本 API,后期文档更新后考虑移除 onMethod('onUIStyleChange', function (res) { oldCallbacks.forEach(callbackId => {