PF
Size: a a a
PF
FB
🐉S
🐉S
AK
🐉S
DK
AK
AK
МИ
🐉S
DK
AS
c
function decorator(Class: new (...args: any[]) => {}) {
const descriptor = Object.getOwnPropertyDescriptors(Class.prototype);
const keys = Object.keys(descriptor);
for (const key of keys) {
if (typeof descriptor[key].value === 'function') {
Object.defineProperty(Class.prototype, key, {
configurable: true,
value() {
console.log('called method ' + key);
return descriptor[key].value.apply(this, arguments);
},
});
}
}
}
@decorator
class Abc {
foo() {}
bar() {}
}
const abc = new Abc();
abc.foo(); // called method foo
abc.bar(); // called method barAS
function decorator(Class: new (...args: any[]) => {}) {
const descriptor = Object.getOwnPropertyDescriptors(Class.prototype);
const keys = Object.keys(descriptor);
for (const key of keys) {
if (typeof descriptor[key].value === 'function') {
Object.defineProperty(Class.prototype, key, {
configurable: true,
value() {
console.log('called method ' + key);
return descriptor[key].value.apply(this, arguments);
},
});
}
}
}
@decorator
class Abc {
foo() {}
bar() {}
}
const abc = new Abc();
abc.foo(); // called method foo
abc.bar(); // called method barW
DK
l