Created
January 2, 2019 18:33
-
-
Save SebastianHGonzalez/aeecca7394d80f2c79803f2aaf74ab90 to your computer and use it in GitHub Desktop.
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 timeAspect(joinPoint, logger) { | |
| const aspect = { | |
| logger, | |
| timer: { | |
| start: function () { this.startTime = Date.now() }, | |
| stop: function () { this.stopTime = Date.now() }, | |
| time: function () { return this.stopTime - this.startTime } | |
| }, | |
| before: function () { this.timer.start() }, | |
| after: function () { this.timer.stop(), this.logger.log(timer.time) } | |
| }; | |
| return decorate(joinPoint, aspect) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment