mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 20:13:07 +00:00
moving toJSON implementation to the BaseContext
This commit is contained in:
parent
16859ff2e2
commit
f04581863c
3 changed files with 10 additions and 16 deletions
|
@ -20,8 +20,8 @@ export type ExcludedFromBaseAudioContext =
|
||||||
|
|
||||||
// the subset of the BaseAudioContext which Tone.Context implements.
|
// the subset of the BaseAudioContext which Tone.Context implements.
|
||||||
export type BaseAudioContextSubset = Omit<
|
export type BaseAudioContextSubset = Omit<
|
||||||
BaseAudioContext,
|
BaseAudioContext,
|
||||||
ExcludedFromBaseAudioContext
|
ExcludedFromBaseAudioContext
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type ContextLatencyHint = AudioContextLatencyCategory;
|
export type ContextLatencyHint = AudioContextLatencyCategory;
|
||||||
|
@ -149,7 +149,14 @@ export abstract class BaseContext
|
||||||
|
|
||||||
abstract immediate(): Seconds;
|
abstract immediate(): Seconds;
|
||||||
|
|
||||||
abstract toJSON(): Record<string, any>;
|
/*
|
||||||
|
* This is a placeholder so that JSON.stringify does not throw an error
|
||||||
|
* This matches what JSON.stringify(audioContext) returns on a native
|
||||||
|
* audioContext instance.
|
||||||
|
*/
|
||||||
|
toJSON(): Record<string, any> {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
readonly isOffline: boolean = false;
|
readonly isOffline: boolean = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -625,13 +625,4 @@ export class Context extends BaseContext {
|
||||||
intervalFn();
|
intervalFn();
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This is a placeholder so that JSON.stringify does not throw an error
|
|
||||||
* This matches what JSON.stringify(audioContext) returns on a native
|
|
||||||
* audioContext instance.
|
|
||||||
*/
|
|
||||||
toJSON() {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,9 +197,5 @@ export class DummyContext extends BaseContext {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly isOffline: boolean = false;
|
readonly isOffline: boolean = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue