3 Star 0 Fork 0

mirrors_zhaozg/lua-webview-1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webview-init.js 889 Bytes
一键复制 编辑 原始数据 按行查看 历史
/*
This script triggers the webview launcher initialisation sequence.
By default the initialisation is done on first load, this script provides support for navigation and page reload.
Lua code in HTML must support multiple executions as well as onWebviewInitalized handler.
*/
(function() {
var timeoutDelay = 1;
function handleLoad() {
if ((typeof window.external !== 'object') || (typeof window.external.invoke !== 'function')) {
if (timeoutDelay > 30000) {
throw 'window.external is not available';
}
setTimeout(handleLoad, timeoutDelay); // Let external.invoke be registered
timeoutDelay = timeoutDelay * 2;
} else if (typeof window.webview !== 'object') {
window.external.invoke(':init:');
}
}
if (document.readyState === 'complete') {
handleLoad();
} else {
window.addEventListener('load', handleLoad);
}
})();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_zhaozg/lua-webview-1.git
git@gitee.com:mirrors_zhaozg/lua-webview-1.git
mirrors_zhaozg
lua-webview-1
lua-webview-1
master

搜索帮助