Skip to content

Commit

Permalink
feat: methods decorated with async advices now return a promise which…
Browse files Browse the repository at this point in the history
… wraps the original task

fix #118
  • Loading branch information
k1r0s committed Nov 20, 2018
1 parent 24eac73 commit 5a12989
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 120 deletions.
2 changes: 0 additions & 2 deletions docs/api.md
Expand Up @@ -149,5 +149,3 @@ class View {
setPermission () { ... }
}
```

Be careful, since decorated methods with **async Advices** return `undefined`
8 changes: 0 additions & 8 deletions docs/faq.md
Expand Up @@ -35,10 +35,6 @@ This is the minimal `tsconfig.json`.

kaop-ts uses metadata properties inside methods or classes. If you alter that references by reasignment you'll mess Advice call stack.

### Avoid async Advices with some frameworks functions (i.e.: React `render` function)

Careful when adding async Advices to some frameworks functions, let's say `render` method of React component. In this case, the method will be evaluated as `undefined` messing up React rendering.

### Useful Tips

> Join points decorators can be stacked and used sync or asynchronously.
Expand All @@ -48,7 +44,3 @@ Careful when adding async Advices to some frameworks functions, let's say `rende
> You can prevent main method execution by calling `meta.prevent`.
> Some contexts or metadata may be accessible in several cases. For example: trying to modify method arguments at `after` join point doesn't have any sense. *Maybe for communication purposes between advices*.
> You should not perform async calls during `beforeInstance` join points because you will mess up instantiation of that class.
> Async advices return 'undefined'

0 comments on commit 5a12989

Please sign in to comment.