({ init, before, after, settled } = kEmptyObject)
| 103 | const onSettled = makeUseHook('settled'); |
| 104 | |
| 105 | function createHook({ init, before, after, settled } = kEmptyObject) { |
| 106 | const hooks = []; |
| 107 | |
| 108 | if (init) ArrayPrototypePush(hooks, onInit(init)); |
| 109 | if (before) ArrayPrototypePush(hooks, onBefore(before)); |
| 110 | if (after) ArrayPrototypePush(hooks, onAfter(after)); |
| 111 | if (settled) ArrayPrototypePush(hooks, onSettled(settled)); |
| 112 | |
| 113 | return () => { |
| 114 | for (const stop of hooks) { |
| 115 | stop(); |
| 116 | } |
| 117 | }; |
| 118 | } |
| 119 | |
| 120 | module.exports = { |
| 121 | createHook, |
no test coverage detected
searching dependent graphs…