UNPKG

519 BJavaScriptView Raw
1import _ from './wrap/lodash'
2import * as quibble from 'quibble'
3import store from './store'
4
5const onResetHandlers = []
6let onNextResetHandlers = []
7
8export default _.tap(() => {
9 store.reset()
10 quibble.reset()
11 _.each(onResetHandlers, (resetHandler) =>
12 resetHandler())
13 _.each(onNextResetHandlers, (resetHandler) =>
14 resetHandler())
15 onNextResetHandlers = []
16}, (reset) => {
17 reset.onReset = (func) =>
18 onResetHandlers.push(func)
19
20 reset.onNextReset = (func) =>
21 onNextResetHandlers.push(func)
22})