[backport] Fixing the bad debounces

stable
Alejandro Alonso 2014-10-10 12:40:23 +02:00
parent b483a38d98
commit 8f05763f18
4 changed files with 10 additions and 6 deletions

View File

@ -26,7 +26,7 @@ toggleText = @.taiga.toggleText
scopeDefer = @.taiga.scopeDefer
bindOnce = @.taiga.bindOnce
groupBy = @.taiga.groupBy
debounce = @.taiga.debounce
debounceLeading = @.taiga.debounceLeading
module = angular.module("taigaBacklog")
@ -130,7 +130,7 @@ BacklogFiltersDirective = ($log, $location) ->
$ctrl.loadUserstories()
selectQFilter = debounce 400, (value) ->
selectQFilter = debounceLeading 100, (value) ->
return if value is undefined
if value.length == 0
$ctrl.replaceFilter("q", null)

View File

@ -27,7 +27,7 @@ toString = @.taiga.toString
joinStr = @.taiga.joinStr
groupBy = @.taiga.groupBy
bindOnce = @.taiga.bindOnce
debounce = @.taiga.debounce
debounceLeading = @.taiga.debounceLeading
startswith = @.taiga.startswith
module = angular.module("taigaIssues")
@ -577,7 +577,7 @@ IssuesFiltersDirective = ($log, $location, $rs, $confirm, $loading) ->
$scope.$on "filters:loaded", (ctx, filters) ->
initializeSelectedFilters(filters)
selectQFilter = debounce 400, (value) ->
selectQFilter = debounceLeading 100, (value) ->
return if value is undefined
if value.length == 0
$ctrl.replaceFilter("q", null)

View File

@ -24,7 +24,7 @@ taiga = @.taiga
groupBy = @.taiga.groupBy
bindOnce = @.taiga.bindOnce
mixOf = @.taiga.mixOf
debounce = @.taiga.debounce
debounceLeading = @.taiga.debounceLeading
trim = @.taiga.trim
module = angular.module("taigaSearch", [])
@ -63,7 +63,7 @@ class SearchController extends mixOf(taiga.Controller, taiga.PageMixin)
# Search input watcher
@scope.searchTerm = ""
loadSearchData = debounce(200, (t) => @.loadSearchData(t))
loadSearchData = debounceLeading(100, (t) => @.loadSearchData(t))
@scope.$watch "searchTerm", (term) =>
if not term

View File

@ -106,6 +106,9 @@ joinStr = (str, coll) ->
debounce = (wait, func) ->
return _.debounce(func, wait, {leading: true, trailing: false})
debounceLeading = (wait, func) ->
return _.debounce(func, wait, {leading: false, trailing: true})
startswith = (str1, str2) ->
return _.str.startsWith(str1, str2)
@ -140,5 +143,6 @@ taiga.scopeDefer = scopeDefer
taiga.toString = toString
taiga.joinStr = joinStr
taiga.debounce = debounce
taiga.debounceLeading = debounceLeading
taiga.startswith = startswith
taiga.sizeFormat = sizeFormat