-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Function.prototype.before = function(beforeFn) {
const _this = this;
return function() {
beforeFn.call(this, arguments);
_this.call(this, arguments);
};
};
Function.prototype.after = function(afterFn) {
const _this = this;
return function() {
_this.call(this, arguments);
afterFn.call(this, arguments);
};
}
function originFn() {
console.log(1);
}
originFn
.before(function() {
console.log(2);
})
.after(function() {
console.log(3);
})();Metadata
Metadata
Assignees
Labels
No labels