Created
September 22, 2014 15:38
-
-
Save kurai021/cda507512bc1a9e2fa29 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
window.onunload = function() { | |
var request_reopen = navigator.mozAlarms.add(new Date((+new Date()) + 30000), 'ignoreTimezone', { | |
type: 'yolo' | |
}); | |
console.log('setting to', new Date((+new Date()) + 30000) + '') | |
request_reopen.onsuccess = function() { | |
console.log('success'); | |
} | |
request_reopen.onerror = function() { | |
console.error('err'); | |
} | |
navigator.mozSetMessageHandler('alarm', function() { | |
console.log('alarm'); | |
launchSelf(); | |
}); | |
function launchSelf() { | |
var request_launchself = window.navigator.mozApps.getSelf(); | |
request_launchself.onsuccess = function() { | |
if (request_launchself.result) { | |
request_launchself.result.launch(); | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment