Last active
June 6, 2017 04:19
-
-
Save nick-pww/9626837 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir c3a | |
cd c3a; | |
yo angular; #accept all the defaults | |
#in order for grunt to pass I had to run the following first: | |
npm install karma-jasmine --save-dev; | |
npm install karma-chrome-launcher --save-dev; | |
#now you should be able to run | |
grunt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cordova create c3c --link-to=c3a/app #KEY ARGUMENT --link-to | |
cd c3c | |
cordova platform add android |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var CordovaInit = function() { | |
var onDeviceReady = function() { | |
receivedEvent('deviceready'); | |
}; | |
var receivedEvent = function(event) { | |
console.log('Start event received, bootstrapping application setup.'); | |
angular.bootstrap($('body'), ['c3aApp']); | |
}; | |
this.bindEvents = function() { | |
document.addEventListener('deviceready', onDeviceReady, false); | |
}; | |
//If cordova is present, wait for it to initialize, otherwise just try to | |
//bootstrap the application. | |
if (window.cordova !== undefined) { | |
console.log('Cordova found, wating for device.'); | |
this.bindEvents(); | |
} else { | |
console.log('Cordova not found, booting application'); | |
receivedEvent('manual') | |
} | |
}; | |
$(function() { | |
console.log('Bootstrapping!'); | |
new CordovaInit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, Is it guaranteed that device ready always fires after document ready?