diff --git a/assets/Script/Manager.ts b/assets/Script/Manager.ts index 7a6093e..4126073 100644 --- a/assets/Script/Manager.ts +++ b/assets/Script/Manager.ts @@ -31,6 +31,22 @@ export default class Manager extends cc.Component { let self: this = this; // this._text_to_Speech = new Text_to_Speech(); + let href: string = window.location.href; + + // let url: string = `http://220.134.195.1/public/bonus_casino/html5/jianmiau/Test/?host=${href}&v=${Date.now()}`; + // let url: string = `https://karolchang.github.io/jm-expense-vue-ts/?host=${href}&ignore=${Date.now()}`; + // let url: string = `http://karol.jianmiau.cf/jm-expense-vue-ts/?v=${Date.now()}`; + let url: string = `https://jm-expense-2022.firebaseapp.com/login?host=${href}&v=${Date.now()}`; + this.webview.url = url; + this.webview.node.active = true; + + cc.view.setResizeCallback(this._resize.bind(this)); + this._resize(); + + const FCMToken: string = NativeClass.Instance.GetFCMToken(); + console.log(`FCMToken ${FCMToken}`); + + // Set EventListener window.addEventListener("message", function (e: MessageEvent): void { let data: any = e.data; let method: string = data.method; @@ -47,7 +63,7 @@ export default class Manager extends cc.Component { } let scheme: string = "jmka"; this.webview.setJavascriptInterfaceScheme(scheme); - this.webview.setOnJSCallback((sender, url) => { + this.webview.setOnJSCallback((sender: any, url: any) => { let data: JSON = JSON.parse(decodeURI(url.split(`${scheme}://`)[1])); let method: any = data["method"]; let value: any = data["value"]; @@ -55,20 +71,6 @@ export default class Manager extends cc.Component { self.Birdge(method, ...value); } }); - let href: string = window.location.href; - - // let url: string = `http://220.134.195.1/public/bonus_casino/html5/jianmiau/Test/?host=${href}&v=${Date.now()}`; - // let url: string = `https://karolchang.github.io/jm-expense-vue-ts/?host=${href}&ignore=${Date.now()}`; - // let url: string = `http://karol.jianmiau.cf/jm-expense-vue-ts/?v=${Date.now()}`; - let url: string = `https://jm-expense-2022.firebaseapp.com/login?host=${href}&v=${Date.now()}`; - this.webview.url = url; - this.webview.node.active = true; - - cc.view.setResizeCallback(this._resize.bind(this)); - this._resize(); - - const FCMToken: string = NativeClass.Instance.GetFCMToken(); - console.log(`FCMToken ${FCMToken}`); } /** 跨版本溝通