Skip to content

Instantly share code, notes, and snippets.

@kof
Created June 25, 2014 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kof/a69c93cb931d9fa6886b to your computer and use it in GitHub Desktop.
Save kof/a69c93cb931d9fa6886b to your computer and use it in GitHub Desktop.
Famo.us app init
exports.ready = new Promise(function(fulfill, reject) {
var isResized, isDomReady
var isDeviceReady = !window.cordova
context.on('resize', function() {
isResized = true
resolve()
})
domready(function() {
isDomReady = true
resolve()
})
document.addEventListener('deviceready', function() {
isDeviceReady = true
resolve()
})
function resolve() {
if (isResized && isDomReady && isDeviceReady) fulfill()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment