How to use the @polymer/polymer/lib/utils/debounce.js.Debouncer.debounce function in @polymer/polymer

To help you get started, we’ve selected a few @polymer/polymer 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 preignition / multi-chart / src / helper / multi-brush.js View on Github external
_observeSelectedValues() {
    this._debounceSelect = Debouncer.debounce(
      this._debounceSelect, // initially undefined
      microTask,
      () => {
        this.log && console.log('brush selection', this.selectedValues);
        this.dispatchEvent(new CustomEvent('multi-select', {
          detail: {
            isRange: this.isRange,
            selection: this.selectedValues
          },
          bubbles: true,
          composed: true
        }));
      });
  }
github preignition / multi-chart / src / helper / multi-legend.js View on Github external
debounceDraw() {
    this._debounceDraw = Debouncer.debounce(
      this._debounceDraw, // initially undefined
      timeOut.after(10),
      () => {
        this.draw(this._shaped);
        // this._isDrawn = true;
      });
  }
github Polymer / shop / src / shop-detail.js View on Github external
_itemChanged(item, visible) {
    if (visible) {
      this._itemChangeDebouncer = Debouncer.debounce(this._itemChangeDebouncer,
        microTask, () => {
          // The item description contains escaped HTML (e.g. "<br>"), so we need to
          // unescape it ("<br>") and set it as innerHTML.
          let text = item ? item.description : '';
          this.$.desc.innerHTML = this._unescapeText(text);

          // Reset the select menus.
          this.$.quantitySelect.value = '1';
          this.$.sizeSelect.value = 'M';

          this.dispatchEvent(new CustomEvent('change-section', {
            bubbles: true, composed: true, detail: {
              category: item ? item.category : '',
              title: item ? item.title : '',
              description: item ? item.description.substring(0, 100) : '',
              image: item ? this.baseURI + item.image : ''
github nuxeo / nuxeo-ui-elements / nuxeo-slots.js View on Github external
_updateContent() {
      this.__renderDebouncer = Debouncer.debounce(
        this.__renderDebouncer, idlePeriod,
        () => {
          this._clearContent();
          this._render();
        },
      );
      // enqueuing is needed for testing, as it allows content to be stamped on flush
      enqueueDebouncer(this.__renderDebouncer);
    }
github nodecg / nodecg / src / dashboard / elements / ncg-workspace.js View on Github external
shiftPackery() {
		if (!this.usePackery) {
			return;
		}

		// Called when anything in #panels receives a click or tap event.
		// There's probably a lot of room to optimize this and not call
		// this routine for every single click,
		// but this was just the easiest way to ensure that mutations
		// caused by clicks are caught, because those mutations might
		// have changed the vertical size of the panel.

		this._shiftPackeryDebounce = Debouncer.debounce(
			this._shiftPackeryDebounce,
			timeOut.after(100), () => {
				if (this._packeryInitialized) {
					// See http://packery.metafizzy.co/methods.html#shiftlayout for more details
					this._packery.shiftLayout();
				}
			}
		);
	}
github nuxeo / nuxeo-elements / ui / widgets / nuxeo-actions-menu.js View on Github external
_layout(e) {
      if (e &amp;&amp; e.type &amp;&amp; e.composedPath().find((el) =&gt; el.id === 'reparent' || el.id === 'dropdownButton')) {
        return; // skip events from within reparented actions
      }
      this.__layoutDebouncer = Debouncer.debounce(this.__layoutDebouncer, microTask, () =&gt; {
        let els = this._getDropdownElements();
        /**
         * XXX: We're using this.contentWidth instead of this.scrollWidth because it takes too much time to be
         * updated on polyfilled browsers (Firex and Edge), leading to an empty menu if there's a single element
         * that doesn't fit on the menu.
         */
        while (els.length &amp;&amp; this.contentWidth &lt;= this.clientWidth) {
          this._moveToMenu(els.shift());
        }
        if (!els.length) {
          this.$.dropdownButton.hidden = true;
        }
        // let's move any element in the menu to the "dropdown" slot if it doesn't fit
        els = this._getMenuElements();
        while (els.length &amp;&amp; this.contentWidth + this.$.dropdownButton.offsetWidth &gt; this.clientWidth) {
          this._moveToDropdown(els.pop());
github PolymerElements / iron-list / iron-list.js View on Github external
_debounce: function(name, cb, asyncModule) {
    if (IS_V2) {
      this._debouncers = this._debouncers || {};
      this._debouncers[name] = Debouncer.debounce(
          this._debouncers[name], asyncModule, cb.bind(this));
      enqueueDebouncer(this._debouncers[name]);
    } else {
      addDebouncer(this.debounce(name, cb));
    }
  },
github nodecg / nodecg / src / dashboard / elements / ncg-workspace.js View on Github external
applyPackery() {
		this._applyPackeryDebounce = Debouncer.debounce(
			this._applyPackeryDebounce,
			timeOut.after(10), () => {
				if (this._packeryInitialized) {
					this._packery.layout();
				}
			}
		);
	}
github PolymerElements / iron-list / iron-list.js View on Github external
_debounce: function(name, cb, asyncModule) {
    this._debouncers = this._debouncers || {};
    this._debouncers[name] =
        Debouncer.debounce(this._debouncers[name], asyncModule, cb.bind(this));
    enqueueDebouncer(this._debouncers[name]);
  },

@polymer/polymer

The Polymer library makes it easy to create your own web components. Give your element some markup and properties, and then use it on a site. Polymer provides features like dynamic templates and data binding to reduce the amount of boilerplate you need to

BSD-3-Clause
Latest version published 3 months ago

Package Health Score

90 / 100
Full package analysis