Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : phonegap's deviceready event with canjs and steal

$
0
0
  1. // Bind Event Listeners
  2. //
  3. // Bind any events that are required on startup. Common events are:
  4. // 'load', 'deviceready', 'offline', and 'online'.
  5. bindEvents: function() {
  6. document.addEventListener('deviceready', this.onDeviceReady, false);
  7. },
  8. // deviceready Event Handler
  9. //
  10. // The scope of 'this' is the event. In order to call the 'receivedEvent'
  11. // function, we must explicitly call 'app.receivedEvent(...);'
  12. onDeviceReady: function() {
  13. app.receivedEvent('deviceready');
  14. },
  15. // Update DOM on a Received Event
  16. receivedEvent: function(id) {

  17. steal('myApp.js');

  18. console.log('Received Event: ' + id);
  19. }

Et voila! :)

Viewing all articles
Browse latest Browse all 3491

Trending Articles