chicken_dy/Assets/WX-WASM-SDK/wechat-default/open-data/open-data-js-sdk/index.js

25 lines
752 B
JavaScript
Executable File
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.

import Layout from './minigame-canvas-engine/index';
//绘制引擎文档可以参考 https://wechat-miniprogram.github.io/minigame-canvas-engine/
let isDestroyed = true; //是否已经被销毁
export default {
/**
* 初始化
* @param fun 主逻辑开始的函数unity里面调用 WX.ShowOpenData 会通知到这里
*/
start(fun){
wx.onMessage(data => {
if(data.type === "WXDestroy"){
isDestroyed = true;
return Layout.clearAll();
}else if(data.type === "WXRender"){
Layout.repaint();
if(isDestroyed){
isDestroyed = false;
fun(data);
}
}
});
}
}