UNPKG

2.08 kBTypeScriptView Raw
1import { DataInterface, EventCallbacksWithAny, EventPayloads, Id } from "./data-interface";
2/**
3 * [[DataSet]] code that can be reused in [[DataView]] or other similar implementations of [[DataInterface]].
4 *
5 * @typeParam Item - Item type that may or may not have an id.
6 * @typeParam IdProp - Name of the property that contains the id.
7 */
8export declare abstract class DataSetPart<Item, IdProp extends string> implements Pick<DataInterface<Item, IdProp>, "on" | "off"> {
9 private readonly _subscribers;
10 protected _trigger(event: "add", payload: EventPayloads<Item, IdProp>["add"], senderId?: Id | null): void;
11 protected _trigger(event: "update", payload: EventPayloads<Item, IdProp>["update"], senderId?: Id | null): void;
12 protected _trigger(event: "remove", payload: EventPayloads<Item, IdProp>["remove"], senderId?: Id | null): void;
13 /** @inheritDoc */
14 on(event: "*", callback: EventCallbacksWithAny<Item, IdProp>["*"]): void;
15 /** @inheritDoc */
16 on(event: "add", callback: EventCallbacksWithAny<Item, IdProp>["add"]): void;
17 /** @inheritDoc */
18 on(event: "remove", callback: EventCallbacksWithAny<Item, IdProp>["remove"]): void;
19 /** @inheritDoc */
20 on(event: "update", callback: EventCallbacksWithAny<Item, IdProp>["update"]): void;
21 /** @inheritDoc */
22 off(event: "*", callback: EventCallbacksWithAny<Item, IdProp>["*"]): void;
23 /** @inheritDoc */
24 off(event: "add", callback: EventCallbacksWithAny<Item, IdProp>["add"]): void;
25 /** @inheritDoc */
26 off(event: "remove", callback: EventCallbacksWithAny<Item, IdProp>["remove"]): void;
27 /** @inheritDoc */
28 off(event: "update", callback: EventCallbacksWithAny<Item, IdProp>["update"]): void;
29 /**
30 * @deprecated Use on instead (PS: DataView.subscribe === DataView.on).
31 */
32 subscribe: DataSetPart<Item, IdProp>["on"];
33 /**
34 * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off).
35 */
36 unsubscribe: DataSetPart<Item, IdProp>["off"];
37 get testLeakSubscribers(): any;
38}
39//# sourceMappingURL=data-set-part.d.ts.map
\No newline at end of file