Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function measureTime(target, key, desc) {
- const fn = desc.value
- const { name } = fn
- desc.value = function(...args) {
- console.time(name)
- const result = fn.apply(this, ...args)
- console.timeEnd(name)
- return result
- }
- }
- // ...
- class Editor {
- @measureTime
- onChange(nextState) {
- // Do something
- }
- }
Add Comment
Please, Sign In to add comment