MCPcopy
hub / github.com/wilsonpage/fastdom / flush

Function flush

fastdom.js:185–209  ·  view source on GitHub ↗

* Runs queued `read` and `write` tasks. * * Errors are caught and thrown by default. * If a `.catch` function has been defined * it is called instead. * * @private

(fastdom)

Source from the content-addressed store, hash-verified

183 * @private
184 */
185function flush(fastdom) {
186 debug('flush');
187
188 var writes = fastdom.writes;
189 var reads = fastdom.reads;
190 var error;
191
192 try {
193 debug('flushing reads', reads.length);
194 fastdom.runTasks(reads);
195 debug('flushing writes', writes.length);
196 fastdom.runTasks(writes);
197 } catch (e) { error = e; }
198
199 fastdom.scheduled = false;
200
201 // If the batch errored we may still have tasks queued
202 if (reads.length || writes.length) scheduleFlush(fastdom);
203
204 if (error) {
205 debug('task errored', error.message);
206 if (fastdom.catch) fastdom.catch(error);
207 else throw error;
208 }
209}
210
211/**
212 * Remove an item from an Array.

Callers

nothing calls this directly

Calls 1

scheduleFlushFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…