From 3de181df4024edec349505fd58c3ed20e77f65f7 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Fri, 31 Aug 2018 08:18:21 -0400 Subject: [PATCH] Unify global access & assignment so we always use self. --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 9734cd6..ffefa62 100644 --- a/src/index.js +++ b/src/index.js @@ -20,7 +20,7 @@ const PARAMS = []; let nextPort; if (typeof AudioWorkletNode !== 'function') { - window.AudioWorkletNode = function AudioWorkletNode (context, name, options) { + self.AudioWorkletNode = function AudioWorkletNode (context, name, options) { const processor = getProcessorsForContext(context)[name]; const scriptProcessor = context.createScriptProcessor(); @@ -47,13 +47,13 @@ if (typeof AudioWorkletNode !== 'function') { return scriptProcessor; }; - Object.defineProperty((window.AudioContext||webkitAudioContext).prototype, 'audioWorklet', { + Object.defineProperty((self.AudioContext || self.webkitAudioContext).prototype, 'audioWorklet', { get () { - return this.$$audioWorklet || (this.$$audioWorklet = new window.AudioWorklet(this)); + return this.$$audioWorklet || (this.$$audioWorklet = new self.AudioWorklet(this)); } }); - window.AudioWorklet = class AudioWorklet { + self.AudioWorklet = class AudioWorklet { constructor (audioContext) { this.$$context = audioContext; }