hy-event-store icon indicating copy to clipboard operation
hy-event-store copied to clipboard

fix(event-store): add dispatch supports the form of Promise

Open Thunder7991 opened this issue 1 year ago • 0 comments

 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') 缺少返回值

Thunder7991 avatar Dec 26 '23 09:12 Thunder7991