Use AOP in Vue Components with TypeScript and Kaop-ts

Share this video with your friends

Send Tweet
Published 4 years ago
Updated 3 years ago

Aspect Oriented Programming, AOP, allows to reuse logic across an entire app in a very neat way, decoupling it from the business logic. Kaop-ts bring us decorators in order to apply AOP. This lesson will show you how you can move cache and exception handling out of your business logic using TypeScript and Kaop-ts

~ 4 years ago

Kaop-ts improve the way he declare advices, now you can just do this:

const getCached = meta => {
  console.log('before exectued')
  const cached = localStorage.getItem('App_handler')
  if (cached) {
    meta.scope.userName = cached

// *Or better in this case
const getCached = afterMethod(meta => {...})

// Inside component
   // *Or just @getCached
handler() {

instead of extend AdvicePool

~ 4 years ago

Hi, since kaop-ts@3.x you cannot extend from AdvicePool

Ref ->

Metadata ->