UNPKG

1.05 kBTypeScriptView Raw
1import { AnyAudioContext } from "./context/AudioContext.js";
2import { BaseContext } from "./context/BaseContext.js";
3/**
4 * Returns the default system-wide {@link Context}
5 * @category Core
6 */
7export declare function getContext(): BaseContext;
8/**
9 * Set the default audio context
10 * @param context
11 * @param disposeOld Pass `true` if you don't need the old context to dispose it.
12 * @category Core
13 */
14export declare function setContext(context: BaseContext | AnyAudioContext, disposeOld?: boolean): void;
15/**
16 * Most browsers will not play _any_ audio until a user
17 * clicks something (like a play button). Invoke this method
18 * on a click or keypress event handler to start the audio context.
19 * More about the Autoplay policy
20 * [here](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio)
21 * @example
22 * document.querySelector("button").addEventListener("click", async () => {
23 * await Tone.start();
24 * console.log("context started");
25 * });
26 * @category Core
27 */
28export declare function start(): Promise<void>;