科尔多瓦:所有模块加载后如何调用方法 [英] cordova: how to call method after all modules are loaded
本文介绍了科尔多瓦:所有模块加载后如何调用方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Cordova,也正在使用一些插件.所以现在我想在所有插件/模块都加载后执行任务.如何在科尔多瓦实现这一目标?插件加载后,Cordova是否提供任何callback
?
I am using Cordova and I'm using some plugins too. So now I want to do the task after all of the plugins/modules are loaded. How to achieve this in Cordova? Does Cordova provide any callback
after the plugins are loaded?
我使用过onload,但现在我想要替代它.加载所有模块后,Cordova是否提供了一些回调来调用.
I have used onload but now i want some alternate to it. Is there some callback provided by Cordova to be called after all modules are loaded.
推荐答案
您可以使用deviceready
.查看示例....
You can use deviceready
. Check out the example ....
<!DOCTYPE html>
<html>
<head>
<title>Device Ready Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
// Now safe to use device APIs
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>
...来自文档.
这篇关于科尔多瓦:所有模块加载后如何调用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文