mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
rebuilding site Thu Jun 30 11:43:08 AM CST 2022
This commit is contained in:
parent
ce465b53e3
commit
d5e26f165a
228 changed files with 1786 additions and 26411 deletions
19
zh/searchurl/js/beep.js
Normal file
19
zh/searchurl/js/beep.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
//data:charset=utf-8,
|
||||
var audioCtx = new window.AudioContext;
|
||||
function beep(duration, frequency, volume, type, callback) {
|
||||
var oscillator = audioCtx.createOscillator();
|
||||
var gainNode = audioCtx.createGain();
|
||||
|
||||
oscillator.connect(gainNode);
|
||||
gainNode.connect(audioCtx.destination);
|
||||
|
||||
if (volume){gainNode.gain.value = volume;}
|
||||
if (frequency){oscillator.frequency.value = frequency;}
|
||||
if (type){oscillator.type = type;}
|
||||
if (callback){oscillator.onended = callback;}
|
||||
|
||||
oscillator.start(audioCtx.currentTime);
|
||||
oscillator.stop(audioCtx.currentTime + ((duration || 500) / 1000));
|
||||
};
|
||||
beep();
|
||||
self.close();
|
Loading…
Add table
Add a link
Reference in a new issue