-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathStackflowActions.ts
More file actions
70 lines (59 loc) · 1.61 KB
/
StackflowActions.ts
File metadata and controls
70 lines (59 loc) · 1.61 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import type {
PausedEvent,
PoppedEvent,
PushedEvent,
ReplacedEvent,
ResumedEvent,
StepPoppedEvent,
StepPushedEvent,
StepReplacedEvent,
} from "../event-types";
import type { BaseDomainEvent } from "../event-types/_base";
import type { DispatchEvent } from "../event-utils";
import type { Stack } from "../Stack";
export type StackflowActions = {
/**
* Get current stack state
*/
getStack: () => Stack;
/**
* Dispatch new event to the core without pre-effect hooks
*/
dispatchEvent: DispatchEvent;
/**
* Push new activity
*/
push: (params: Omit<PushedEvent, keyof BaseDomainEvent>) => void;
/**
* Push new activity in the top and remove current top activity when new activity is activated
*/
replace: (params: Omit<ReplacedEvent, keyof BaseDomainEvent>) => void;
/**
* Remove top activity
*/
pop: (params?: Omit<PoppedEvent, keyof BaseDomainEvent>) => void;
/**
* Push new step in current activity
*/
stepPush: (params: Omit<StepPushedEvent, keyof BaseDomainEvent>) => void;
/**
* Replace current step in current activity
*/
stepReplace: (params: Omit<StepReplacedEvent, keyof BaseDomainEvent>) => void;
/**
* Remove current step
*/
stepPop: (params?: Omit<StepPoppedEvent, keyof BaseDomainEvent>) => void;
/**
* Pause stack change
*/
pause: (params?: Omit<PausedEvent, keyof BaseDomainEvent>) => void;
/**
* Resume paused stack
*/
resume: (params?: Omit<ResumedEvent, keyof BaseDomainEvent>) => void;
/**
* Clear past events and reconstruct state with active activities to release memory
*/
prune: () => void;
};