inheritable-audio-context
Wrap an AudioContext to allow inheritance and additional properties.
If you want to do this (for whatever reason):
var context = var subContext = ObjectsubContextsomeValueOnlyOnSubContext = 'VALUE'var gain = subContext // TypeError: Illegal invocation
It throws an error. This module allows you to achieve the same thing but without the error.
Install
npm install inheritable-audio-context
Examples
Extend existing AudioContext
var InheritableAudioContext = var audioContext = var subContext = var subGain = subContextsubGain // can be connected to original audioContext subContextextendedProperty = 'VALUE'audioContextextendedProperty //= undefined var subContext2 = Object // values inherit down proto chainsubContextinheritedDownValue = 'VALUE'subContext2inheritedDownValue //= 'VALUE' // but not back upsubContext2someAdditionalValue = 'VALUE'subContextsomeAdditionalValue //= undefined // InheritableAudioContext inherits from AudioContextsubContext instanceof AudioContext //= truesubContext instanceof InheritableAudioContext //= true
Standalone
var InheritableAudioContext = var rootContext = var subContext = Object // values inherit down proto chainrootContextvalueAtRoot = 1234subContextvalueAtRoot //= 1234 // but not back upsubContextsomeAdditionalValue = 'VALUE'rootContextsomeAdditionalValue //= undefined