retrofit
v0.2.11
Published
Dynamically extend classes
Downloads
34
Readme
Retrofit
Dynamically extend classes
git clone [email protected]: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']