智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/72/72cee820966b8a67de5fe3e0f93...

15 lines
587 B

export function publishHandler (eventType, args, pageIds) {
args = JSON.stringify(args)
if (process.env.NODE_ENV !== 'production') {
console.log(`UNIAPP[publishHandler]:[${+new Date()}]`, eventType, args, pageIds)
}
if (!Array.isArray(pageIds)) {
pageIds = [pageIds]
}
const evalJSCode =
`typeof UniViewJSBridge !== 'undefined' && UniViewJSBridge.subscribeHandler("${eventType}",${args},__PAGE_ID__)`
pageIds.forEach(id => {
const webview = plus.webview.getWebviewById(String(id))
webview && webview.evalJS(evalJSCode.replace('__PAGE_ID__', id))
})
}