Clone attachment to other piece

This commit is contained in:
2025-10-15 15:06:41 +02:00
parent 8c05c0e825
commit 589994d62f
7 changed files with 275 additions and 181 deletions

View File

@@ -9,16 +9,28 @@ export const mapProp = <const K extends string, T>(prop: K, action: Update<T>) =
export interface Store {
readonly user: User | null;
readonly pieceQueryName: string;
readonly pieceQueryAuthor: string;
}
let store: Store = Object.freeze<Store>({
user: null,
pieceQueryName: "",
pieceQueryAuthor: "",
});
export function setUser(action: Update<User | null>) {
set(mapProp("user", action));
}
export function setPieceQueryName(action: Update<string>) {
set(mapProp("pieceQueryName", action));
}
export function setPieceQueryAuthor(action: Update<string>) {
set(mapProp("pieceQueryAuthor", action));
}
// --- STORE IMPLEMENTATION ----------------------------------------------------
class Listener<T> {