mobx-loading
mobx-loading copied to clipboard
@loading 修饰过的方法不能 catch
虽然 catch 到异常了, 但是异常仍然被抛到了外面.
Uncaught (in promise) Error: test
class MyStore {
@loading async load() {
throw new Error('test')
}
}
(async () => {
try {
await new MyStore().load()
} catch (err) {
console.log(err.message)
}
})()
class Test {
@loading
func = () => {};
}
现在的 mobx-loading 支持箭头函数吗?
class Test { @loading func = () => {}; }
现在的 mobx-loading 支持箭头函数吗?
支持的
class Test { @loading func = () => {}; }
现在的 mobx-loading 支持箭头函数吗?
支持的
https://github.com/niqingyang/mobx-loading/blob/f88217654b82836a5353ead059a2fdecd6200d35/src/loadingDecorator.js#L120
这里没实现。应该是不支持的把。
用 typescript 的时候 descriptor 为 undefined
https://github.com/mobxjs/mobx/blob/fd009da98770b76018a284d2f619968e440ec17a/src/api/actiondecorator.ts#L87
ts 和 babel 的箭头函数不一样