0.2.11 • Published 7 years ago
retrofit v0.2.11
Retrofit
Dynamically extend classes
git clone git@github.com:invrs/retrofit.git
cd retrofit
npm install
npm test
Usage
let A = class {
a() { console.log("A#a") }
}
let B = build(A, [
[ /./, ({ args, fn, instance }) => {
console.log("args", args)
return fn.apply(instance, args)
} ],
[ "b", ({ args }) =>
console.log("args", args)
]
])
new B().a("hello")
// args ['hello']
// A#a
new B().b("hello")
// args ['hello']