mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-28 12:33:12 +00:00
efbd3c7f5f
Also add in no-unused-expression-chai rule so that chai works with tslint.
18 lines
509 B
TypeScript
18 lines
509 B
TypeScript
export function isDisposed(instance): void {
|
|
for (const prop in instance) {
|
|
if (instance.hasOwnProperty(prop)) {
|
|
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)) {
|
|
if (member !== null) {
|
|
throw Error("property was not completely disposed: " + prop);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|