|
@@ -1,17 +1,19 @@
|
|
-const hook =
|
|
|
|
|
|
+const devtoolHook =
|
|
typeof window !== 'undefined' &&
|
|
typeof window !== 'undefined' &&
|
|
window.__VUE_DEVTOOLS_GLOBAL_HOOK__
|
|
window.__VUE_DEVTOOLS_GLOBAL_HOOK__
|
|
|
|
|
|
export default function devtoolPlugin (store) {
|
|
export default function devtoolPlugin (store) {
|
|
- if (!hook) return
|
|
|
|
|
|
+ if (!devtoolHook) return
|
|
|
|
|
|
- hook.emit('vuex:init', store)
|
|
|
|
|
|
+ store._devtoolHook = devtoolHook
|
|
|
|
|
|
- hook.on('vuex:travel-to-state', targetState => {
|
|
|
|
|
|
+ devtoolHook.emit('vuex:init', store)
|
|
|
|
+
|
|
|
|
+ devtoolHook.on('vuex:travel-to-state', targetState => {
|
|
store.replaceState(targetState)
|
|
store.replaceState(targetState)
|
|
})
|
|
})
|
|
|
|
|
|
store.subscribe((mutation, state) => {
|
|
store.subscribe((mutation, state) => {
|
|
- hook.emit('vuex:mutation', mutation, state)
|
|
|
|
|
|
+ devtoolHook.emit('vuex:mutation', mutation, state)
|
|
})
|
|
})
|
|
}
|
|
}
|