Update debounce to random timeout

stable
Álex Hermida 2018-07-04 09:53:46 +02:00 committed by Alex Hermida
parent dc41c1ebbd
commit 008b04f309
2 changed files with 7 additions and 1 deletions

View File

@ -345,7 +345,8 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
initializeSubscription: ->
routingKey1 = "changes.project.#{@scope.projectId}.userstories"
@events.subscribe @scope, routingKey1, debounceLeading(500, (message) =>
randomTimeout = taiga.randomInt(700, 1000)
@events.subscribe @scope, routingKey1, debounceLeading(randomTimeout, (message) =>
@.loadUserstories())
loadInitialData: ->

View File

@ -266,6 +266,10 @@ getMatches = (string, regex, index) ->
return matches
randomInt = (start, end) ->
interval = end - start
return start + Math.floor(Math.random()*(interval+1))
taiga = @.taiga
taiga.addClass = addClass
taiga.nl2br = nl2br
@ -297,3 +301,4 @@ taiga.patch = patch
taiga.getRandomDefaultColor = getRandomDefaultColor
taiga.getDefaulColorList = getDefaulColorList
taiga.getMatches = getMatches
taiga.randomInt = randomInt