I´m new to PhoneGap/CoffeeScript trying to get a Hello World App running in iOS and wonder what I´m doing wrong.
This would be my standard index.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">
<script type="text/javascript" charset="utf-8" src="cordova-1.6.0.js"></script>
<script type="text/javascript" charset="utf-8" src="app.js"></script>
</head>
<body onload="onBodyLoad()">
<h1>Hey, it's Cordova!</h1>
<p>Don't know how to get started? Check out our <em><a target="_blank" href="http://docs.phonegap.com/en/edge/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS">Getting Started Guide</a></em>
</body>
</html>
And the app.js generated from app.coffee looks like this:
(function() {
var onBodyLoad, onDeviceReady;
onBodyLoad = function() {
return document.addEventListener("deviceready", onDeviceReady, false);
};
onDeviceReady = function() {
return navigator.notification.alert("This alert never happens!");
};
}).call(this);
When I delete the first line "(function() {" and the last line "}).call(this);" of the app.js get the alert and everything is working properly. But I guess there´s a better way than deleting this lines everytime CoffeeScript compiles into JavaScript.
thank you very much, Jakob