Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Timeout
  2.   id: null
  3.   cleared: false
  4.  
  5.   constructor: (fn, interval, scope, args) ->
  6.     scope = scope or window
  7.     wrap = =>
  8.       @clear()
  9.       fn.apply(scope, args or arguments)
  10.     @id = setTimeout(wrap, interval)
  11.  
  12.   clear: ->
  13.     clearTimeout(@id)
  14.     @cleared = true
  15.     @id = null
  16.  
  17. window.Timeout = Timeout
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement