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