mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-29 04:53:10 +00:00
17 lines
488 B
TypeScript
17 lines
488 B
TypeScript
|
export function isDisposed(instance){
|
||
|
for (let prop in instance) {
|
||
|
const member = instance[prop];
|
||
|
if (typeof member !== "function" &&
|
||
|
typeof member !== "string" &&
|
||
|
typeof member !== "number" &&
|
||
|
typeof member !== "boolean" &&
|
||
|
typeof member !== "undefined" &&
|
||
|
prop !== "preset" &&
|
||
|
!(member instanceof AudioContext) &&
|
||
|
!instance.constructor.prototype[prop]) {
|
||
|
if (member !== null) {
|
||
|
throw Error("property was not completely disposed: " + prop);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|