source/joosy/modules/time_manager.coffee in joosy-1.2.0.alpha.54 vs source/joosy/modules/time_manager.coffee in joosy-1.2.0.alpha.55
- old
+ new
@@ -10,10 +10,11 @@
#
# Registeres timeout for current object
#
# @param [Integer] timeout Miliseconds to wait
# @param [Function] action Action to run on timeout
+ # @return [Integer] Timer
#
setTimeout: (timeout, action) ->
@__timeouts ||= []
timer = window.setTimeout (=> action()), timeout
@@ -24,17 +25,34 @@
#
# Registeres interval for current object
#
# @param [Integer] delay Miliseconds between runs
# @param [Function] action Action to run
+ # @return [Integer] Timer
#
setInterval: (delay, action) ->
@__intervals ||= []
timer = window.setInterval (=> action()), delay
@__intervals.push timer
timer
+
+ #
+ # Clears tmeout preventing callback from execution
+ #
+ # @param [Integer] timer Timer
+ #
+ clearTimeout: (timer) ->
+ window.clearTimeout timer
+
+ #
+ # Clears inteval preventing callback from execution
+ #
+ # @param [Integer] timer Timer
+ #
+ clearInterval: (timer) ->
+ window.clearInterval timer
#
# Drops all registered timeouts and intervals for this object
#
__clearTime: ->
\ No newline at end of file