Skip to content

Commit

Permalink
⚗️ [Dummy] Experiment with offering a dummy Earwurm
Browse files Browse the repository at this point in the history
  • Loading branch information
beefchimi committed Dec 22, 2023
1 parent c40fae8 commit af06071
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
69 changes: 69 additions & 0 deletions src/dummy/DummyEarwurm.ts
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;
}
}
1 change: 1 addition & 0 deletions src/dummy/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {DummyEarwurm} from './DummyEarwurm';
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export {Earwurm} from './Earwurm';
export {Stack} from './Stack';
export {Sound} from './Sound';

// export * from './dummy';

export type {
ManagerState,
ManagerEventMap,
Expand Down

0 comments on commit af06071

Please sign in to comment.