mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibWeb: Implement OscillatorNode.type
This is a simple getter and setter of the OscillatorType enum, with error checking to not allow 'custom', as that should only be changed through 'setPeriodicWave()'.
This commit is contained in:
parent
b48ba823b9
commit
099c9e4a7e
Notes:
sideshowbarker
2024-07-16 20:08:14 +09:00
Author: https://github.com/shannonbooth
Commit: 099c9e4a7e
Pull-request: https://github.com/SerenityOS/serenity/pull/24195
5 changed files with 61 additions and 2 deletions
|
@ -15,5 +15,22 @@
|
|||
|
||||
// Context getter
|
||||
println(`context: '${oscillator.context}, is same as original: ${audioContext === oscillator.context}`);
|
||||
|
||||
// Invalid type in constructor
|
||||
try {
|
||||
new OscillatorNode(audioContext, { type: 'custom' });
|
||||
} catch (e) {
|
||||
println(`Error creating node: '${e}'`);
|
||||
}
|
||||
|
||||
// Type attribute
|
||||
println(`oscillator node type: '${oscillator.type}'`);
|
||||
try {
|
||||
oscillator.type = 'custom';
|
||||
} catch (e) {
|
||||
println(`Error: '${e}', type is: ${oscillator.type}`);
|
||||
}
|
||||
oscillator.type = 'triangle';
|
||||
println(`oscillator node type: '${oscillator.type}'`);
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue