( state: CurrentScript | undefined = defaultCurrentScript, action: CurrentScriptAction, )
| 71 | type CurrentScriptAction = SetAction | UnsetAction | PatchDataAction | SetIsChangedAction; |
| 72 | |
| 73 | function currentScriptReducer( |
| 74 | state: CurrentScript | undefined = defaultCurrentScript, |
| 75 | action: CurrentScriptAction, |
| 76 | ) { |
| 77 | switch (action.type) { |
| 78 | case CurrentScriptActionType.SET: |
| 79 | return set(action.script); |
| 80 | case CurrentScriptActionType.UNSET: |
| 81 | return unset(); |
| 82 | case CurrentScriptActionType.PATCH_DATA: |
| 83 | return patchData(state, action.data); |
| 84 | case CurrentScriptActionType.SET_IS_CHANGED: |
| 85 | return setIsChanged(state, action.isChanged); |
| 86 | default: |
| 87 | console.error('Invalid action type', action); |
| 88 | return state; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | export type { CurrentScriptAction }; |
| 93 |
nothing calls this directly
no test coverage detected