Skip to content

Commit

Permalink
🐛 [store] fix v3 "e is undefined" bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jxn-30 committed Nov 20, 2020
1 parent 8befbda commit c826e64
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,20 @@ export default (Vue: VueConstructor): Store<RootState> => {
// @ts-ignore
trueBase[trueEvent] = (...args: unknown[]) => {
document.dispatchEvent(
new CustomEvent(`lssm_${event}_before`, {
new CustomEvent(`${PREFIX}_${event}_before`, {
detail: args,
})
);
state.hooks[event](...args);
document.dispatchEvent(
new CustomEvent(`lssm_${event}_after`, {
new CustomEvent(`${PREFIX}_${event}_after`, {
detail: args,
})
);
};
}
document.addEventListener(
`lssm_${event}_${post ? 'after' : 'before'}`,
`${PREFIX}_${event}_${post ? 'after' : 'before'}`,
event =>
callback(...((event as unknown) as LSSMEvent).detail)
);
Expand Down Expand Up @@ -241,7 +241,7 @@ export default (Vue: VueConstructor): Store<RootState> => {
// @ts-ignore
trueBase.__proto__[event] = (...args: unknown[]) => {
document.dispatchEvent(
new CustomEvent(`lssm_${eventString}_before`, {
new CustomEvent(`${PREFIX}_${eventString}_before`, {
detail: args,
})
);
Expand All @@ -250,14 +250,14 @@ export default (Vue: VueConstructor): Store<RootState> => {
...args
);
document.dispatchEvent(
new CustomEvent(`lssm_${eventString}_after`, {
new CustomEvent(`${PREFIX}_${eventString}_after`, {
detail: args,
})
);
};
}
document.addEventListener(
`lssm_${eventString}_${post ? 'after' : 'before'}`,
`${PREFIX}_${eventString}_${post ? 'after' : 'before'}`,
event =>
callback(...((event as unknown) as LSSMEvent).detail)
);
Expand Down

0 comments on commit c826e64

Please sign in to comment.