# Piece
A piece is almost like a placeholder - a placeholder for data that we're going to save into some instance of Store
(checkout Store for more info).
The most common use for a Piece
in Abrevio is for it to be a BaseCommand
, or a BaseEvent
.
However, that isn't always the case. Sometimes a Piece
will be used in order to represent some data which might be more correspondant to caching.
The recommended way of using this instance is for extentensions, not instantiations individually.
However, if you wish to instantiate it, there's a brief example on how to right below this text.
# Example of how to instantiate a Piece correctly
(TS)
import { Piece, Store, AbrevioClient } from "abrevio";
const client: AbrevioClient = new AbrevioClient();
const data: Store<string, string[]> = new Store(client, "data", ["some", "data"]);
const piece: Piece = new Piece(client, {
name: "my piece",
store: data,
type: "data/information",
enabled: true
})
(JS)
const { Piece, Store, AbrevioClient } = require("abrevio");
const client = new AbrevioClient();
const data = new Store(client, "data", ["some", "data"]);
const piece = new Piece(client, {
name: "my piece",
store: data,
type: "data/information",
enabled: true
})