02-25-2012 09:59 PM
Consider the folowing code:
<html>
<head>
<script type="text/javascript">
function log(line) {
if( console == null || console.log == null )
{
return;
}
console.log(line);
}
function doSomething(context) {
log("page load event, context is: " + context);
}
window.addEventListener("load", doSomething, false);
</script>
</head>
<body>
<h2> this is a test</h2>
</body>
</html>the "page load event, context is [object Event]" will be printed twice. This is causing some havoc in my application. This only happens in the ripple emulator, not in any other browswer.
Is there a work around for this? I found that if I wrap it in a setTimeout I am ok, but that seems a little hokey....
Solved! Go to Solution.
02-26-2012 12:18 AM
It is a quirk with Ripple and how it loads pages. You may want to use your setTimeout function during your dev and pull it out when you test on device or submit.
02-27-2012 09:30 PM
02-29-2012 01:21 PM
As another solution rather than a setTimeout you could check for blackberry existing in your init (if you have one).
if (typeof window.blackberry === "undefined"){
return false;
}
This should stop it running that first time before Ripple renders it.
02-29-2012 04:01 PM
Honestly I don't use Ripple for anything but building, packaging and signing. Other than that, it's simulator or device testing for me.
04-20-2012 05:27 AM