tone 14.8.47 → 14.8.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Tone/core/context/Context.test.ts +1 -2
- package/Tone/core/context/Context.ts +8 -1
- package/Tone/version.ts +1 -1
- package/build/Tone.js +1 -1
- package/build/Tone.js.map +1 -1
- package/build/esm/core/context/Context.d.ts +4 -0
- package/build/esm/core/context/Context.js +7 -1
- package/build/esm/core/context/Context.js.map +1 -1
- package/docs/tone.json +1 -1
- package/package.json +1 -1
|
@@ -120,8 +120,7 @@ describe("Context", () => {
|
|
|
120
120
|
await context.resume();
|
|
121
121
|
await new Promise<void>((done) => setTimeout(() => done(), 10));
|
|
122
122
|
expect(triggerChange).to.equal(true);
|
|
123
|
-
context.dispose();
|
|
124
|
-
return ac.close();
|
|
123
|
+
return context.dispose();
|
|
125
124
|
});
|
|
126
125
|
});
|
|
127
126
|
|
|
@@ -94,6 +94,11 @@ export class Context extends BaseContext {
|
|
|
94
94
|
*/
|
|
95
95
|
private _initialized = false;
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Private indicator if a close() has been called on the context, since close is async
|
|
99
|
+
*/
|
|
100
|
+
private _closeStarted = false;
|
|
101
|
+
|
|
97
102
|
/**
|
|
98
103
|
* Indicates if the context is an OfflineAudioContext or an AudioContext
|
|
99
104
|
*/
|
|
@@ -485,7 +490,8 @@ export class Context extends BaseContext {
|
|
|
485
490
|
* any AudioNodes created from the context will be silent.
|
|
486
491
|
*/
|
|
487
492
|
async close(): Promise<void> {
|
|
488
|
-
if (isAudioContext(this._context)) {
|
|
493
|
+
if (isAudioContext(this._context) && (this.state !== "closed") && !this._closeStarted) {
|
|
494
|
+
this._closeStarted = true;
|
|
489
495
|
await this._context.close();
|
|
490
496
|
}
|
|
491
497
|
if (this._initialized) {
|
|
@@ -530,6 +536,7 @@ export class Context extends BaseContext {
|
|
|
530
536
|
Object.keys(this._constants).map((val) =>
|
|
531
537
|
this._constants[val].disconnect()
|
|
532
538
|
);
|
|
539
|
+
this.close();
|
|
533
540
|
return this;
|
|
534
541
|
}
|
|
535
542
|
|
package/Tone/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version: string = "14.8.
|
|
1
|
+
export const version: string = "14.8.48";
|