| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8757799 commit f0f31d0
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -207,23 +207,23 @@ function storeActiveHooks() { | |||
| 207 | 207 | // Don't want to make the assumption that kInit to kDestroy are indexes 0 to | |
| 208 | 208 | // 4. So do this the long way. | |
| 209 | 209 | active_hooks.tmp_fields = []; | |
| 210 | - active_hooks.tmp_fields[kInit] = async_hook_fields[kInit]; | ||
| 211 | - active_hooks.tmp_fields[kBefore] = async_hook_fields[kBefore]; | ||
| 212 | - active_hooks.tmp_fields[kAfter] = async_hook_fields[kAfter]; | ||
| 213 | - active_hooks.tmp_fields[kDestroy] = async_hook_fields[kDestroy]; | ||
| 214 | - active_hooks.tmp_fields[kPromiseResolve] = async_hook_fields[kPromiseResolve]; | ||
| 210 | + copyHooks(active_hooks.tmp_fields, async_hook_fields); | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + function copyHooks(destination, source) { | ||
| 214 | + destination[kInit] = source[kInit]; | ||
| 215 | + destination[kBefore] = source[kBefore]; | ||
| 216 | + destination[kAfter] = source[kAfter]; | ||
| 217 | + destination[kDestroy] = source[kDestroy]; | ||
| 218 | + destination[kPromiseResolve] = source[kPromiseResolve]; | ||
| 215 | 219 | } | |
| 216 | 220 | ||
| 217 | 221 | ||
| 218 | 222 | // Then restore the correct hooks array in case any hooks were added/removed | |
| 219 | 223 | // during hook callback execution. | |
| 220 | 224 | function restoreActiveHooks() { | |
| 221 | 225 | active_hooks.array = active_hooks.tmp_array; | |
| 222 | - async_hook_fields[kInit] = active_hooks.tmp_fields[kInit]; | ||
| 223 | - async_hook_fields[kBefore] = active_hooks.tmp_fields[kBefore]; | ||
| 224 | - async_hook_fields[kAfter] = active_hooks.tmp_fields[kAfter]; | ||
| 225 | - async_hook_fields[kDestroy] = active_hooks.tmp_fields[kDestroy]; | ||
| 226 | - async_hook_fields[kPromiseResolve] = active_hooks.tmp_fields[kPromiseResolve]; | ||
| 226 | + copyHooks(async_hook_fields, active_hooks.tmp_fields); | ||
| 227 | 227 | ||
| 228 | 228 | active_hooks.tmp_array = null; | |
| 229 | 229 | active_hooks.tmp_fields = null; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments