Advanced
Custom Structures
Override built-in structures (Player, Node, LyricsManager) safely.
Hoshimi allows replacing default classes through Structures.
Use this when you need project-specific behavior without forking core internals.
Type reference: Core API (TypeDoc)
Quick links:
Structure type links:
- PlayerStructure
- NodeStructure
- QueueStructure
- TrackStructure
- UnresolvedTrackStructure
- LyricsManagerStructure
Related registry:
Basic Override Pattern
import { , } from 'hoshimi';
class extends {
public (): boolean {
return this. > 120;
}
}
. = (...) => new (...);
interface CustomizableStructures {
: ;
}Multiple Overrides
import { , , , } from 'hoshimi';
class extends {}
class extends {}
class extends {}
. = (...) => new (...);
. = (...) => new (...);
. = (...) => new (...);
interface CustomizableStructures {
: ;
: ;
: ;
}Custom Data Types (Module Augmentation)
import type { LyricsResult } from 'hoshimi';
declare module 'hoshimi' {
interface CustomizablePlayerStorage {
: boolean;
: boolean;
: string;
: LyricsResult;
}
interface CustomizableTrack {
: {
: string;
: string;
};
}
}Best Practices
- Override structures once during bootstrap.
- Keep constructor signatures unchanged.
- Add narrow, domain-specific methods instead of rewriting core flow.