Skip to content

Commit

Permalink
Unify global access & assignment so we always use self.
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Aug 31, 2018
1 parent eca684d commit 3de181d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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;
}
Expand Down

0 comments on commit 3de181d

Please sign in to comment.