phonegap deviceready事件 - 波纹仿真器 [英] phonegap deviceready event - ripple emulator
问题描述
你好全部
我有一些问题,在初始phonegapdeviceready事件处理程序没有被正确触发,在波纹chrome扩展电话模拟器。
hello all
Im having some problems with the initial phonegap 'deviceready' event-handler not being triggered properly, in the ripple chrome extension phonegap emulator.
<script src="xui-2.0.0.js" type="text/javascript" charset="utf-8"></script>
<script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<!--
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
<script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
-->
<script type="text/javascript" charset="utf-8" src="phonegap.0.9.4.js"></script>
<!-- <script type="text/javascript" charset="utf-8" src="main.js"></script> -->
<script>
function onLoad() {
//console.log(document);
/*document.addEventListener('deviceready',function() {
console.log('PHONEGAP_READY');
},false);*/
console.log('ON_LOAD');
x$(document).on('deviceready', function() {
console.log('PHONEGAP_READY');
}, false);
}
</script>
所以问题是console.log('PHONEGAP_READY')永远不会运行。我在这里使用XUI只是为了尝试官方涟漪电话演示工作的方式(在他们的页面上发布的)。既不是,也不是document.addEventListener(),工作...什么奇怪的是,chrome控制台输出读取PhoneGap :: fired deviceready事件!所以Im假设事件真的是触发,但事件处理程序本身没有被调用...
任何线索感谢
so the issue is that the console.log('PHONEGAP_READY') is never run. I used XUI here just to try the way the official ripple phonegap demos work (ones posted on their page). neither that, nor the document.addEventListener(), work... whats strange is that the chrome console output reads "PhoneGap :: fired deviceready event!" so Im assuming the event really is firing, but the event handler itself is not being called...
any clues are appreciated
感谢
thanks
推荐答案
有一个奇怪的是如何纹理模拟phonegap的运行时:点击此处
There is a quirk in how ripple emulates the runtime for phonegap: docs here
ripple将在文档加载之前注入phonegap运行时,如果您包含phonegap.js文件
ripple will inject the phonegap runtime before the document loads and if you include the phonegap.js file in your app it will override the ripple emulated environment and that may cause issues.
尝试从您的网页中删除phonegap源码,然后重新载入以查看是否有帮助。
Try removing the phonegap source from your page and reloading to see if that helps.
这篇关于phonegap deviceready事件 - 波纹仿真器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!