How to use the asap/raw.requestFlush 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 nathanmarks / stylishly / packages / stylishly / src / renderers / domRenderer.js View on Github external
*/
  const bufferContent = { default: '' };

  /**
   * The event emitting virtual renderer
   *
   * @type {Object}
   */
  const renderer = createVirtualRenderer();

  /**
   * Requests an ASAP flush
   *
   * @type {Function}
   */
  renderer.requestFlush = asap.requestFlush;

  renderer.events.on('renderSheet', (id, rules, options) => {
    buffer((css) => {
      const ruleString = rulesToCSS(rules);
      if (css.indexOf(ruleString) === -1) {
        return css + ruleString;
      }
      return css;
    }, options);
  });

  renderer.events.on('removeSheet', (id, rules, options) => {
    buffer((css) => css.replace(rulesToCSS(rules), ''), options);
  });

  renderer.events.on('removeAll', () => {

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