-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚗️ [Dummy] Experiment with offering a dummy Earwurm
- Loading branch information
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import {tokens} from '../tokens'; | ||
import type {LibraryEntry, LibraryKeys} from '../types'; | ||
|
||
// TODO: Ideally we can do something like `implements Earwurm`, | ||
// but changing all internal logic to be "dumb". | ||
export class DummyEarwurm { | ||
static readonly maxStackSize = tokens.maxStackSize; | ||
static readonly suspendAfterMs = tokens.suspendAfterMs; | ||
|
||
private _volume = 1; | ||
private _mute = false; | ||
|
||
readonly unlocked = false; | ||
readonly state = 'closed'; | ||
readonly playing = false; | ||
|
||
constructor() { | ||
this._volume = 1; | ||
this._mute = false; | ||
} | ||
|
||
get volume() { | ||
return this._volume; | ||
} | ||
|
||
set volume(value: number) { | ||
this._volume = value; | ||
} | ||
|
||
get mute() { | ||
return this._mute; | ||
} | ||
|
||
set mute(value: boolean) { | ||
this._mute = value; | ||
} | ||
|
||
get keys() { | ||
return []; | ||
} | ||
|
||
get(_id: LibraryEntry['id']) { | ||
return undefined; | ||
} | ||
|
||
has(_id: LibraryEntry['id']) { | ||
return false; | ||
} | ||
|
||
unlock() { | ||
return this; | ||
} | ||
|
||
add(..._entries: LibraryEntry[]): LibraryKeys { | ||
return []; | ||
} | ||
|
||
remove(..._ids: LibraryKeys): LibraryKeys { | ||
return []; | ||
} | ||
|
||
stop() { | ||
return this; | ||
} | ||
|
||
teardown() { | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {DummyEarwurm} from './DummyEarwurm'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters