Guest User

Untitled

a guest
May 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. function measureTime(target, key, desc) {
  2. const fn = desc.value
  3. const { name } = fn
  4.  
  5. desc.value = function(...args) {
  6. console.time(name)
  7. const result = fn.apply(this, ...args)
  8. console.timeEnd(name)
  9. return result
  10. }
  11. }
  12.  
  13. // ...
  14. class Editor {
  15. @measureTime
  16. onChange(nextState) {
  17. // Do something
  18. }
  19. }
Add Comment
Please, Sign In to add comment