How to use the ember-inspector/computed/debounce function in ember-inspector

To help you get started, we’ve selected a few ember-inspector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emberjs / ember-inspector / app / controllers / render-tree.js View on Github external
}
  }),

  /**
   * Indicate the table's header's height in pixels.
   *
   * @property headerHeight
   * @type {Number}
   */
  headerHeight: computed('isWarningClosed', function() {
    return this.isWarningClosed ? 31 : 56;
  }),

  // bound to the input field, updates the `search` property
  // 300ms after changing
  searchValue: debounceComputed('search', 300),

  // model filtered based on this value
  search: '',

  escapedSearch: computed('search', function() {
    return escapeRegExp(this.search.toLowerCase());
  }),

  filtered: computed('model.@each.name', 'search', function() {
    if (isEmpty(this.escapedSearch)) {
      return this.model;
    }

    return this.model.filter((item) => {
      const regExp = new RegExp(this.escapedSearch);
      return recursiveMatch(item, regExp);
github emberjs / ember-inspector / app / controllers / deprecations.js View on Github external
import { action, computed } from '@ember/object';
import Controller from '@ember/controller';
import debounceComputed from 'ember-inspector/computed/debounce';
import searchMatch from 'ember-inspector/utils/search-match';

export default Controller.extend({
  init() {
    this._super(...arguments);
    this.deprecations = [];
  },

  search: null,
  searchValue: debounceComputed('search', 300),
  toggleDeprecationWorkflow: false,

  filtered: computed('deprecations.@each.message', 'search', function() {
    return this.deprecations.filter(item => searchMatch(item.message, this.search));
  }),

  openResource: action(function(item) {
    this.adapter.openResource(item.fullSource, item.line);
  }),

  traceSource: action(function(deprecation, source) {
    this.port.send('deprecation:sendStackTraces', {
      deprecation: {
        message: deprecation.message,
        sources: [source]
      }
github emberjs / ember-inspector / app / controllers / container-type.js View on Github external
import { action, get, computed } from '@ember/object';
import Controller, { inject as controller } from '@ember/controller';
import debounceComputed from 'ember-inspector/computed/debounce';
import searchMatch from 'ember-inspector/utils/search-match';

export default Controller.extend({
  application: controller(),

  searchValue: debounceComputed('search', 300),

  search: null,

  filtered: computed('model.@each.name', 'search', function() {
    return this.model
      .filter((item) => searchMatch(get(item, 'name'), this.search));
  }),

  rows: computed('filtered.[]', function() {
    return this.filtered.map(function(item) {
      return {
        name: item
      };
    });
  }),