-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathredux-undo.redux.txt
26 lines (22 loc) · 1.68 KB
/
redux-undo.redux.txt
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
┏━━━━━━━━━━━━━━━━┓
┃ REDUX-UNDO ┃
┗━━━━━━━━━━━━━━━━┛
VERSION ==> #0.6.0
#Wraps a RFUNC to keep track of STATE changes and replay them.
UNDO.ActionCreators.
undo|redo()|jumpToPast|Future(NUM)
->UNDO_ACTION #UNDO_ACTION.type is UNDO.ActionTypes.UNDO|REDO|JUMP_TO_PAST|JUMP_TO_FUTURE
UDO.undoable(RFUNC[,CONF])->RFUNC2#Does:
# - keep RFUNC's STATE history using RFUNC2's STATE2: past|future STATE_ARR, present STATE
# - handles UNDO_ACTION to feed RFUNC with the correct present STATE
#CONF:
# - limit NUM: max number of entries
# - filter(ACTION, NEXT_STATE, PREV_STATE)->BOOL:
# - if false, does not store in undo history
# - can use builtins:
# - UNDO.includeAction|excludeAction(ACTION.type[_ARR]): based on ACTION.type
# - UNDO.distinctState(): based on NEXT_STATE === PREV_STATE
# - initTypes STR[_ARR] (def: ['@@redux/INIT', 'INIT']):
# - ACTION with this type reinit the undo history
# - initialHistory STATE2
# - initialState STATE: same as { initialHistory: { present STATE } }