TypeScript实现aop面向切面编程
npm i super-aop
import aop from 'super-aop'
let fn = () => {
console.log('fn')
return 1
}
fn = aop(fn, {
before() {
console.log('before')
},
after(fnReturn) {
console.log('after')
console.log(fnReturn)
}
})
// before
// fn
// after
// 1