Skip to content

Commit 030f246

Browse files
authored
Merge pull request #14 from github/fix-wrap
Operate on the class object proptype when wrapping
2 parents 6149ef6 + f02370c commit 030f246

File tree

3 files changed

+305
-421
lines changed

3 files changed

+305
-421
lines changed

catalyst/src/wrap.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export function wrap(obj: any, name: string, fn: (...args: any[]) => any) {
2-
if (!obj[name]) {
2+
if (!obj.prototype[name]) {
33
obj[name] = fn
44
} else {
5-
const oldFn = obj[name]
6-
obj[name] = function () {
5+
const oldFn = obj.prototype[name]
6+
obj.prototype[name] = function () {
77
oldFn.call(this)
88
fn.call(this, this)
99
}

0 commit comments

Comments
 (0)