Skip to content

Commit

Permalink
Merge pull request #57 from ulion/fix_assign_readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyeo1010 authored Mar 15, 2024
2 parents 289e5b8 + 2c412a3 commit e6e34e3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/polyfill/audioworklet_polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ if (typeof window !== "undefined") {

if (typeof AudioWorkletNode !== 'function' || !('audioWorklet' in AudioContext.prototype)) {
if (AudioContext) {
// @ts-ignore
AudioContext.prototype.audioWorklet = {
// eslint-disable-next-line
addModule: async function (moduleURL: string | URL, options?: WorkletOptions): Promise<void> {
return;
},
};
if (!('audioWorklet' in AudioContext.prototype)) {
// @ts-ignore
AudioContext.prototype.audioWorklet = {
// eslint-disable-next-line
addModule: async function (moduleURL: string | URL, options?: WorkletOptions): Promise<void> {
return;
},
};
}

// @ts-ignore
// eslint-disable-next-line no-native-reassign
window.AudioWorkletNode = function (context: AudioContext, processorName: string, options: any): ScriptProcessorNode {
window.AudioWorkletNode = window.AudioWorkletNode || function (context: AudioContext, processorName: string, options: any): ScriptProcessorNode {
const {numberOfChannels = 1, frameLength = 512} = options && options.processorOptions;
const scriptProcessor: ScriptProcessorNode & ProcessorPolyfill = context.createScriptProcessor(frameLength, numberOfChannels, numberOfChannels);

Expand Down

0 comments on commit e6e34e3

Please sign in to comment.