mobxjs/mobx-utils

@asyncAction with ES6 (not TypeScript)

d4rky-pl opened this issue · 3 comments

It seems that generator functions do not work with decorators.

I've tried using @asynAction something = function*() {} but it does not seem to work properly.

The easiest workaround so far seems to be:

class Foo {
  fetch = asyncAction(function* fetch() {
    // ... code ...
  })
}

It might be a good idea to add this to README :) I can send a PR if you agree.

@d4rky-pl agreed :)

Why not just call a regular action within an async function?

@mweststrate This will take a bit longer, I'm afraid. The comments in code are not always valid JSDOC so every time documentation is regenerated, there are some things missing, some broken etc. I will dig into it when I have more spare time :)