Skip to content

Instantly share code, notes, and snippets.

@k1r0s
Last active February 10, 2018 13:20
Show Gist options
  • Save k1r0s/137131b2f7494baf395ed899c2277fbb to your computer and use it in GitHub Desktop.
Save k1r0s/137131b2f7494baf395ed899c2277fbb to your computer and use it in GitHub Desktop.

These properties can be accessed by:

@beforeInstance(function(meta) {
  meta.args // Arguments to be received by decorated method
  meta.key // Name of the decorated method as string
  meta.scope // Instance or the context of the call stack
  meta.method // Original method
  meta.target // Class definition
  meta.result // The returned value by the method
  meta.exception // current exception (if any). The exception should be handled
  // using `meta.handle()` to avoid error to be thrown.

  meta.commit() // triggers the next advice or method in the
  // call stack (mandatory if your advice contains async operations)

  meta.skip() // prevent execution of following advices until method execution

  meta.handle() // returns the exception (if any) and prevents to be thrown.

  meta.prevent() // prevents the main method to be executed (GUESS WHY).
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment