mc.onThemeChange(Function callback)
监听系统主题改变事件。
参数
参数 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
callback | Function | 是 | 系统主题改变事件的回调函数 |
callback(Object object) 回调参数
属性 | 类型 | 说明 |
---|---|---|
theme | String | 系统当前的主题,取值为light 或dark |
示例代码:
mc.onThemeChange(function(res){
console.log(res.theme);
});