mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 11:33:09 +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.
|
||||
export type BaseAudioContextSubset = Omit<
|
||||
BaseAudioContext,
|
||||
ExcludedFromBaseAudioContext
|
||||
BaseAudioContext,
|
||||
ExcludedFromBaseAudioContext
|
||||
>;
|
||||
|
||||
export type ContextLatencyHint = AudioContextLatencyCategory;
|
||||
|
@ -149,7 +149,14 @@ export abstract class BaseContext
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -625,13 +625,4 @@ export class Context extends BaseContext {
|
|||
intervalFn();
|
||||
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;
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {};
|
||||
}
|
||||
|
||||
readonly isOffline: boolean = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue