app/assets/javascripts/ultimate/helpers.js.coffee.erb in ultimate-base-0.6.2 vs app/assets/javascripts/ultimate/helpers.js.coffee.erb in ultimate-base-0.7.2
- old
+ new
@@ -13,13 +13,13 @@
method = console[method]
if method.apply?
method.apply(console, args)
else
method(args)
- return args[0]
+ args[0]
-@_cout = =>
+@_cout = ->
console.log(arguments) if console?
arguments[0]
@deprecate = (subject, instead = null) =>
@cout 'error', "`#{subject}` DEPRECATED!#{if instead then " Use instead `#{instead}`" else ''}"
@@ -53,5 +53,18 @@
return url if format is currentFormat
ad.push format if format
ah[0] = ad.join('.')
aq[0] = ah.join('#')
aq.join('?')
+
+@waitFor = (delay, times, check, success, fail) ->
+ startWaitFor = ->
+ setTimeout ( ->
+ times--
+ if check()
+ success?(times)
+ else if times > 0
+ startWaitFor()
+ else
+ fail?()
+ ), delay
+ startWaitFor()