in www/browser/notification.js [82:112]
module.exports.beep = window.navigator.notification.beep = function (times) {
if (times > 0) {
var BEEP_DURATION = 700;
var BEEP_INTERVAL = 300;
if (audioContext) {
// Start a beep, using the Audio API
var osc = audioContext.createOscillator();
osc.type = 0; // sounds like a "beep"
osc.connect(audioContext.destination);
osc.start(0);
setTimeout(function () {
// Stop the beep after the BEEP_DURATION
osc.stop(0);
if (--times > 0) {
// Beep again, after a pause
setTimeout(function () {
navigator.notification.beep(times);
}, BEEP_INTERVAL);
}
}, BEEP_DURATION);
} else if (typeof console !== 'undefined' && typeof console.log === 'function') {
// Audio API isn't supported, so just write `beep` to the console
for (var i = 0; i < times; i++) {
console.log('Beep!');
}
}
}
};