tone 15.5.11 → 15.5.12

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.
@@ -5,6 +5,13 @@ import { getContext } from "../Global.js";
5
5
  import { Gain } from "./Gain.js";
6
6
  import { ToneWithContext } from "./ToneWithContext.js";
7
7
 
8
+ /** Exposes {@link ToneWithContext._onContextRunning} for tests without `as any`. */
9
+ class GainWithContextRunning extends Gain {
10
+ public triggerOnContextRunning(callback: () => void): void {
11
+ this._onContextRunning(callback);
12
+ }
13
+ }
14
+
8
15
  describe("ToneWithContext", () => {
9
16
  context("get", () => {
10
17
  it("returns an object with all the default properties", () => {
@@ -58,9 +65,8 @@ describe("ToneWithContext", () => {
58
65
  it("invokes the callback immediately for an offline context", () => {
59
66
  return Offline(() => {
60
67
  let callbackInvoked = false;
61
- const gain = new Gain();
62
- // Access protected method via subclass trick
63
- (gain as any)._onContextRunning(() => {
68
+ const gain = new GainWithContextRunning();
69
+ gain.triggerOnContextRunning(() => {
64
70
  callbackInvoked = true;
65
71
  });
66
72
  expect(callbackInvoked).to.equal(true);
@@ -70,8 +76,8 @@ describe("ToneWithContext", () => {
70
76
 
71
77
  it("cleans up the listener on dispose", () => {
72
78
  return Offline(() => {
73
- const gain = new Gain();
74
- (gain as any)._onContextRunning(() => {
79
+ const gain = new GainWithContextRunning();
80
+ gain.triggerOnContextRunning(() => {
75
81
  // no-op
76
82
  });
77
83
  // Should not throw when disposing
package/Tone/version.ts CHANGED
@@ -1 +1 @@
1
- export const version: string = "15.5.11";
1
+ export const version: string = "15.5.12";