Created
April 24, 2014 21:21
-
-
Save mcav/11269934 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
addAlert: function(alert) { | |
var testOpts = alert.testOpts || {}; | |
if (this.alerts.length) { | |
this.removeCurrentAlert(); | |
} | |
this.alerts.unshift(alert); | |
this.grabScreenLock(); | |
this.grabCPULock(); | |
this.silence(); | |
this.ringLabel.textContent = this.alert.label || | |
mozL10n.get(this.alert.type === 'alarm' ? 'alarm' : 'timer'); | |
this.ringDisplay.dataset.ringType = this.alert.type; | |
this.time.innerHTML = Utils.getLocalizedTimeHtml(alert.time); | |
if (this.alert.sound) { | |
this.ringtonePlayer.playRingtone(this.alert.sound); | |
} | |
if (this.alert.vibrate && ('vibrate' in navigator)) { | |
clearInterval(this.vibrateInterval); | |
var vibrateOnce = function() { | |
navigator.vibrate([1000]); | |
}; | |
this.vibrateInterval = setInterval(vibrateOnce, 2000); | |
vibrateOnce(); | |
} | |
document.documentElement.classList.add('ready'); | |
window.focus(); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment