-
Notifications
You must be signed in to change notification settings - Fork 0
/
ember-phonegap.js
36 lines (36 loc) · 1.33 KB
/
ember-phonegap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Ember.Application.reopenClass({
phoneGapApp: {
// Application Constructor
initialize: function () {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events
// are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function () {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the
// 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function () {
App.phoneGapApp.receivedEvent('deviceready');
},
// Update DOM on a Received Event
receivedEvent: function (id) {
// var parentElement = document.getElementById(id);
// var listeningElement =
// parentElement.querySelector('.listening');
// var receivedElement =
// parentElement.querySelector('.received');
//
// listeningElement.setAttribute('style', 'display:none;');
// receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
}
}
});