How to use the @polymer/polymer/lib/utils/async.js.timeOut.after 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 / drawable / mixin / draw-mixin.js View on Github external
debounceDraw() {
      this.log && console.info('debounce',  this)
      this._debounceDraw = Debouncer.debounce(
        this._debounceDraw, // initially undefined
        timeOut.after(10),
        () => {
          this.log && console.info('debounced',  this)
          const isDrawn = this.draw();
          this._isDrawn = !!isDrawn;
          this.dispatchEvent(new CustomEvent('multi-drawn', {detail: {}, bubbles: true, composed: true})); 
        });
    }
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 / core / nuxeo-page-provider.js View on Github external
_autoFetch() {
      // Reset the page if the query changes
      if (
        this.$.nxResource.params &&
        this.query &&
        this.query.length === 0 &&
        this.query !== this.$.nxResource.params.query
      ) {
        this.page = 1;
      }
      if (this.auto && (this.query || this.provider)) {
        // debounce in case of multiple param changes

        this._debouncer = Debouncer.debounce(this._debouncer, timeOut.after(this.autoDelay), () => this.fetch());
      }
    }
github nodecg / nodecg / src / dashboard / elements / ncg-workspace.js View on Github external
_routeChanged(route) {
		if (this.usePackery) {
			// This is a hack to fix packery when the viewport size is changed
			// when the workspace is not visible.
			if (route.path === this.parentNode.route) {
				this._fixPackeryDebounce = Debouncer.debounce(
					this._fixPackeryDebounce,
					timeOut.after(10),
					this._fixPackery.bind(this)
				);
			}
		}
	}
github nuxeo / nuxeo-elements / core / nuxeo-audit-page-provider.js View on Github external
_autoFetch() {
      if (this.auto) {
        // debounce in case of multiple param changes
        this._debouncer = Debouncer.debounce(this._debouncer, timeOut.after(this.autoDelay), () => this.fetch());
      }
    }
  }
github nuxeo / nuxeo-elements / ui / actions / nuxeo-share-button.js View on Github external
_copyLink(e) {
      const shareButton = e.currentTarget;
      const link = shareButton.previousElementSibling;

      // Select Link
      link.$.paperInput.$.nativeInput.select();
      if (!window.document.execCommand('copy')) {
        return;
      }

      shareButton._debouncer = Debouncer.debounce(shareButton._debouncer, timeOut.after(2000), () => {
        // Unselect Link
        link.$.paperInput.$.nativeInput.setSelectionRange(0, 0);
        link.$.paperInput.blur();
        shareButton.set('icon', 'link');
        shareButton.classList.remove('selected');
      });

      shareButton.set('icon', 'check');
      shareButton.classList.add('selected');
      this.fire('notify', { message: this.i18n('shareButton.operation.copied'), duration: 2000 });
    }
  }
github nodecg / nodecg / src / dashboard / elements / ncg-workspace.js View on Github external
this._panelMutationObserver = new MutationObserver(() => {
				this._handleMutationDebounce = Debouncer.debounce(
					this._handleMutationDebounce,
					timeOut.after(150),
					this._debouncedMutationHandler.bind(this)
				);
			});
github GoogleWebComponents / google-chart / google-chart.js View on Github external
redraw() {
    if (this._chartWrapper == null || this._data == null) return;
    this._chartWrapper.setDataTable(this._data);
    this._chartWrapper.setOptions(this.options || {});

    this._setDrawn(false);
    this._redrawDebouncer = Debouncer.debounce(this._redrawDebouncer, timeOut.after(5), () => {
      this._chartWrapper.draw();
    });
  }
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 nuxeo / nuxeo-ui-elements / nuxeo-page-provider-display-behavior.js View on Github external
_scrollChanged() {
    this._debouncer = Debouncer.debounce(
      this._debouncer, timeOut.after(this.scrollThrottle > 0 ? this.scrollThrottle : 1),
      () => this._fetchRange(this.$.list.firstVisibleIndex, this.$.list.lastVisibleIndex),
    );
  },