Sha256: 0214461644d906b3f1212726a470e3efb279ddb941e801f7491a80549c1ed16f

Contents?: true

Size: 710 Bytes

Versions: 85

Compression:

Stored size: 710 Bytes

Contents

import options from './options';
import { defer } from './util';
import { renderComponent } from './vdom/component';

/**
 * Managed queue of dirty components to be re-rendered
 * @type {Array<import('./component').Component>}
 */
let items = [];

/**
 * Enqueue a rerender of a component
 * @param {import('./component').Component} component The component to rerender
 */
export function enqueueRender(component) {
	if (!component._dirty && (component._dirty = true) && items.push(component)==1) {
		(options.debounceRendering || defer)(rerender);
	}
}

/** Rerender all enqueued dirty components */
export function rerender() {
	let p;
	while ( (p = items.pop()) ) {
		if (p._dirty) renderComponent(p);
	}
}

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
govuk_publishing_components-17.21.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.20.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.19.1 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.19.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.18.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.17.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.16.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.15.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.14.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.13.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.12.2 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.12.1 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.12.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.11.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.10.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.9.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.8.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.7.0 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.6.1 node_modules/preact/src/render-queue.js
govuk_publishing_components-17.6.0 node_modules/preact/src/render-queue.js