-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecord.d.ts
More file actions
34 lines (34 loc) · 1.19 KB
/
record.d.ts
File metadata and controls
34 lines (34 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import * as Interface from '../interface';
export interface IRecord<T> {
undo: (diff?: T) => void;
redo: (diff?: T) => void;
startRecording: (limit?: number) => void;
stopRecording: () => void;
isRecording: () => boolean;
loadRecords: (previouslyRecords?: T[]) => Promise<boolean>;
saveRecords: () => Promise<boolean>;
getRecords: () => string[] | undefined;
clearRecords: () => void;
}
export interface IRecordOption<T, StoreType> {
store: Interface.Readable<StoreType>;
load?: () => Promise<T[]>;
save?: (records: T[]) => Promise<boolean>;
}
export declare class Record<StoreType> implements IRecord<string> {
protected records: string[];
protected option: IRecordOption<string, StoreType>;
protected stopRecorder?: Interface.Unsubscriber;
constructor(option: IRecordOption<string, StoreType>);
undo(diff?: string): void;
redo(diff: string): void;
isCanUndo(): void;
isCanRedo(): void;
startRecording(limit?: number): void;
stopRecording(): void;
isRecording(): boolean;
loadRecords(previouslyRecords?: string[]): Promise<boolean>;
saveRecords(): Promise<boolean>;
getRecords(): string[];
clearRecords(): void;
}