How to use the asap/raw function in asap

To help you get started, we’ve selected a few asap 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 openzipkin / zipkin-js / packages / zipkin-instrumentation-request-promise / src / promise.js View on Github external
function handleResolved(self, deferred) {
  asap(() => {
    const cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
    if (cb === null) {
      if (self._state === 1) {
        resolve(deferred.promise, self._value);
      } else {
        reject(deferred.promise, self._value);
      }
      return;
    }
    const ret = tryCallOne(cb, self._value);
    if (ret === IS_ERROR) {
      reject(deferred.promise, LAST_ERROR);
    } else {
      resolve(deferred.promise, ret);
    }
  });
github nathanmarks / stylishly / packages / stylishly / src / renderers / domRenderer.js View on Github external
function buffer(cb, options = {}) {
    const { group = 'default' } = options;

    if (!bufferContent.hasOwnProperty(group)) {
      bufferContent[group] = '';
    }

    if (!element.hasOwnProperty(group)) {
      element[group] = getStylishlyDOMElement(domDocument, group);
    }

    if (!isBuffering) {
      isBuffering = true;
      Object.keys(bufferContent).forEach((n) => bufferContent[n] = element[n].textContent);
      asap(flushBuffers);
    }

    bufferContent[group] = cb(bufferContent[group]);
  }

asap

High-priority task queue for Node.js and browsers

MIT
Latest version published 7 years ago

Package Health Score

77 / 100
Full package analysis