[0]laya3.0 微信小游戏装饰器不生效
如题,laya ide 上使用没问题,在微信小游戏上没有效果
示例:
示例:
export function regEventOn(eventName:any){在微信上日志没有输出。
console.info("!! regeventon ", eventName)
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
EventSystem.on(eventName, target, target[propertyKey])
};
}
@regEventOn(initEvent.start)
onInitStart(){
console.info("!! show loading")
ViewManager.show(ViewId.loading, ViewLayer.overlay);
}
没有找到相关结果
已邀请:
要回复问题请先登录
3 个回复
小高
赞同来自:
谷主
赞同来自:
Aimumu
赞同来自:
import BaseProxy from "./BaseProxy"
export interface DecorateProxyConstructor {
new (proxyName: string): BaseProxy
}
const ModelProxyMap: { [key: string]: DecorateProxyConstructor } = {}
export const ModelProxyKeys: Array<string> = new Array<string>()
function RegistProxyConstructor(loaderName: string, func: DecorateProxyConstructor) {
console.log("reg proxy", loaderName)
if (ModelProxyKeys.indexOf(loaderName) == -1) {
ModelProxyKeys.push(loaderName)
ModelProxyMap[loaderName] = func
} else {
throw "repeat reg content loader"
}
}
export function GetModelProxyConstructor(loaderName: string) {
return ModelProxyMap[loaderName]
}
export function DecorateModelProxy(loaderName: string) {
console.log("DecorateModelProxy", loaderName)
return function (func: DecorateProxyConstructor) {
RegistProxyConstructor(loaderName, func)
}
}