[add] 防呆
This commit is contained in:
parent
c0ea0d936b
commit
b4571e07aa
@ -62,15 +62,20 @@ export default class Manager extends cc.Component {
|
||||
self.Birdge(method, value);
|
||||
};
|
||||
}
|
||||
let scheme: string = "jmka";
|
||||
let scheme: string = "http";
|
||||
this.webview.setJavascriptInterfaceScheme(scheme);
|
||||
this.webview.setOnJSCallback((sender: any, url: any) => {
|
||||
let data: JSON = JSON.parse(decodeURI(url.split(`${scheme}://`)[1]));
|
||||
let content: string = decodeURI(url.split(`${scheme}://`)[1]);
|
||||
try {
|
||||
let data: JSON = JSON.parse(content);
|
||||
let method: any = data["method"];
|
||||
let value: any = data["value"];
|
||||
if (method) {
|
||||
self.Birdge(method, ...value);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user