Buffer search phrase to fire only after 500ms of last key press

This commit is contained in:
Piotr Sarnacki 2012-10-10 19:20:41 +02:00
parent ed2ddc04f6
commit a15836c50a
4 changed files with 13 additions and 6 deletions

View File

@ -33,8 +33,15 @@ Travis.ReposController = Ember.ArrayController.extend
searchObserver: (->
search = @get('search')
tab = if search then 'search' else 'recent'
@activate(tab, search: search)
if search
@searchFor search
else
@activate 'recent'
'recent'
).observes('search')
searchFor: (phrase) ->
Ember.run.cancel(@searchLater) if @searchLater
@searchLater = Ember.run.later(this, (->
@activate 'search', search: phrase
), 500)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
9cf466ba
ab2d40c2