Class: Piece<Options, StoreName>
Defined in: projects/pieces/src/lib/structures/Piece.ts:56
The piece to be stored in Store instances.
Extended by
Type Parameters
| Type Parameter | Default type | 
|---|---|
| OptionsextendsPieceOptions | PieceOptions | 
| StoreNameextendsStoreRegistryKey | StoreRegistryKey | 
Constructors
Constructor
new Piece<
Options,StoreName>(context:LoaderContext<StoreName>,options:PieceOptions):Piece<Options,StoreName>
Defined in: projects/pieces/src/lib/structures/Piece.ts:82
Parameters
| Parameter | Type | 
|---|---|
| context | LoaderContext<StoreName> | 
| options | PieceOptions | 
Returns
Piece<Options, StoreName>
Properties
enabled
enabled:
boolean
Defined in: projects/pieces/src/lib/structures/Piece.ts:75
Whether or not the piece is enabled.
location
readonlylocation:PieceLocation
Defined in: projects/pieces/src/lib/structures/Piece.ts:65
The location metadata for the piece's file.
name
readonlyname:string
Defined in: projects/pieces/src/lib/structures/Piece.ts:70
The name of the piece.
options
readonlyoptions:Options
Defined in: projects/pieces/src/lib/structures/Piece.ts:80
The raw options passed to this Piece
store
readonlystore:StoreOf<StoreName>
Defined in: projects/pieces/src/lib/structures/Piece.ts:60
The store that contains the piece.
Accessors
container
Get Signature
get container():
Container
Defined in: projects/pieces/src/lib/structures/Piece.ts:94
A reference to the Container object for ease of use.
See
container
Returns
Methods
onLoad()
onLoad():
unknown
Defined in: projects/pieces/src/lib/structures/Piece.ts:102
Per-piece listener that is called when the piece is loaded into the store. Useful to set-up asynchronous initialization tasks.
Returns
unknown
onUnload()
onUnload():
unknown
Defined in: projects/pieces/src/lib/structures/Piece.ts:110
Per-piece listener that is called when the piece is unloaded from the store. Useful to set-up clean-up tasks.
Returns
unknown
reload()
reload():
Promise<void>
Defined in: projects/pieces/src/lib/structures/Piece.ts:125
Reloads the piece by loading the same path in the store.
Returns
Promise<void>
toJSON()
toJSON():
PieceJSON
Defined in: projects/pieces/src/lib/structures/Piece.ts:132
Defines the JSON.stringify behavior of this piece.
Returns
unload()
unload():
Promise<void>
Defined in: projects/pieces/src/lib/structures/Piece.ts:117
Unloads and disables the piece.
Returns
Promise<void>