aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/controllers/packages.js
blob: a1724dd92024f69889b9f0242a652586390c31f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import Ember from 'ember';
export default Ember.Controller.extend({  
  queryObserver : Ember.observer("query",function() {    
    Ember.run.debounce(this, () => {
      const regExp = new RegExp(this.get('query'),"i");
      const packages = this.get('model').filter((p) => p.name.search(regExp) != -1);      
      Ember.run.next(() => {
        this.set('packages',packages);
      });
    }, 300);
  })
});