This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function aspect(joinPoint, { before, around, after }) { | |
| return function (...args) { | |
| before && before(this, joinPoint.name, ...args); | |
| const result = around ? around(this, joinPoint, ...args) : joinPoint.apply(this, args); | |
| after && after(this, joinPoint.name, result, ...args); | |
| return result; | |
| } | |
| } | |
| function loggerAspect(joinPoint, logger) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function loggerAspect(joinPoint, logger) { | |
| return function (...args) { | |
| logger.log("logging"); | |
| return joinPoint.apply(this, args) | |
| } | |
| } | |
| class Person { | |
| constructor(name) { | |
| this.name = name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function loggerAspect(joinPoint, logger) { | |
| return function (...args) { | |
| logger.log("logging"); | |
| return joinPoint.apply(this, args) | |
| } | |
| } | |
| const psyduck = { | |
| sound: "PSYDUCK!", | |
| cuack: function() {return this.sound} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function loggerAspect(joinPoint, logger) { | |
| return (...args) => { | |
| logger.log("logging"); | |
| return joinPoint(...args); | |
| } | |
| } | |
| function add(a, b) { | |
| return a + b; | |
| } |
NewerOlder