Skip to content

Instantly share code, notes, and snippets.

@nick-pww
Last active June 6, 2017 04:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nick-pww/9626837 to your computer and use it in GitHub Desktop.
Save nick-pww/9626837 to your computer and use it in GitHub Desktop.
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;
cordova create c3c --link-to=c3a/app #KEY ARGUMENT --link-to
cd c3c
cordova platform add android
'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();
});
@samithaf
Copy link

Hi, Is it guaranteed that device ready always fires after document ready?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment