MCPcopy Create free account
hub / github.com/alibaba/lowcode-engine / History

Class History

packages/shell/src/model/history.ts:5–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import { IPublicModelHistory, IPublicTypeDisposable } from '@alilc/lowcode-types';
4
5export class History implements IPublicModelHistory {
6 private readonly [documentSymbol]: InnerDocumentModel;
7
8 private get [historySymbol](): InnerHistory {
9 return this[documentSymbol].getHistory();
10 }
11
12 constructor(document: InnerDocumentModel) {
13 this[documentSymbol] = document;
14 }
15
16 /**
17 * 历史记录跳转到指定位置
18 * @param cursor
19 */
20 go(cursor: number): void {
21 this[historySymbol].go(cursor);
22 }
23
24 /**
25 * 历史记录后退
26 */
27 back(): void {
28 this[historySymbol].back();
29 }
30
31 /**
32 * 历史记录前进
33 */
34 forward(): void {
35 this[historySymbol].forward();
36 }
37
38 /**
39 * 保存当前状态
40 */
41 savePoint(): void {
42 this[historySymbol].savePoint();
43 }
44
45 /**
46 * 当前是否是「保存点」,即是否有状态变更但未保存
47 * @returns
48 */
49 isSavePoint(): boolean {
50 return this[historySymbol].isSavePoint();
51 }
52
53 /**
54 * 获取 state,判断当前是否为「可回退」、「可前进」的状态
55 * @returns
56 */
57 getState(): number {
58 return this[historySymbol].getState();
59 }
60
61 /**
62 * 监听 state 变更事件

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…