hy-event-store
hy-event-store copied to clipboard
fix(event-store): add dispatch supports the form of Promise
let obj = {
funcTest: (...args) => {
return new Promise((resolve, reject) => {
resolve('event')
})
},
};
const dispatch = (actionName, ...args) => {
const actionFn = obj[actionName];
actionFn.apply(this, [1, 2, 3]);
};
dispatch('funcTest').then(res => {
console.log(res);
})
Uncaught TypeError: Cannot read properties of undefined (reading 'then') 缺少返回值