How to use asap - 10 common examples

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 elierotenberg / nexus-flux / src / Store.jsx View on Github external
engine.should.be.an.instanceOf(_Engine);
    }
    Object.assign(this, {
      _engine: engine,
      lifespan: new Lifespan(),
    });
    _.bindAll(this, [
      'onUpdate',
      'onDelete',
    ]);

    if(__DEV__) {
      this._onUpdateHandlers = 0;
      this._onDeleteHandlers = 0;
      // check that handlers are immediatly set
      asap(() => {
        try {
          this._onUpdateHandlers.should.be.above(0);
          this._onDeleteHandlers.should.be.above(0);
        }
        catch(err) {
          console.warn('StoreConsumer: both onUpdate and onDelete handlers should be set immediatly.');
        }
      });
    }
  }
github elierotenberg / nexus-flux / src / Action.js View on Github external
constructor(engine) {
    if(__DEV__) {
      engine.should.be.an.instanceOf(_Engine);
    }
    Object.assign(this, {
      _engine: engine,
      lifespan: new Lifespan(),
    });
    _.bindAll(this, ['onDispatch']);

    if(__DEV__) {
      this._onDispatchHandlers = 0;
      asap(() => { // check that handlers are immediatly set
        try {
          this._onDispatchHandlers.should.be.above(0);
        }
        catch(err) {
          console.warn('StoreConsumer: onDispatch handler should be set immediatly.');
        }
      });
    }
  }
github esperantojs / esperanto / comparison / output / esperanto / defaultImport.js View on Github external
(function () {

  'use strict';

  var asap = require('asap');
  
  // example from http://jsmodules.io
  asap.default(function() {
    console.log("hello async world!");
  });

}).call(global);
github esperantojs / esperanto / comparison / output / esperanto / namedImports.js View on Github external
(function () {

  'use strict';

  var asap = require('asap');
  
  // example from http://jsmodules.io
  asap.later(function() {
    console.log("Running after other network events");
  });

}).call(global);
github Khan / aphrodite / src / inject.js View on Github external
if (alreadyInjected[key]) {
        return;
    }

    if (!isBuffering) {
        // We should never be automatically buffering on the server (or any
        // place without a document), so guard against that.
        if (typeof document === "undefined") {
            throw new Error(
                "Cannot automatically buffer without a document");
        }

        // If we're not already buffering, schedule a call to flush the
        // current styles.
        isBuffering = true;
        asap(flushToStyleTag);
    }

    injectionBuffer.push(...generatedCSS);
    alreadyInjected[key] = true;
}
github esperantojs / esperanto / test / output / cjs / mixedImports.js View on Github external
var __imports_0 = require('asap');

var asap = __imports_0.default;
var later = __imports_0.later;
github esperantojs / esperanto / test / output / cjs / mixedImports.js View on Github external
var __imports_0 = require('asap');

var asap = __imports_0.default;
var later = __imports_0.later;
github mendersoftware / gui / node_modules / dnd-core / src / HandlerRegistry.js View on Github external
removeSource(sourceId) {
		invariant(this.getSource(sourceId), 'Expected an existing source.')
		this.store.dispatch(removeSource(sourceId))

		asap(() => {
			delete this.handlers[sourceId]
			delete this.types[sourceId]
		})
	}
github react-dnd / dnd-core / src / HandlerRegistry.js View on Github external
removeTarget(targetId) {
    invariant(this.getTarget(targetId), 'Expected an existing target.');
    this.store.dispatch(removeTarget(targetId));

    asap(() => {
      delete this.handlers[targetId];
      delete this.types[targetId];
    });
  }
github barbuza / kebakaran / src / sagaCb.js View on Github external
function listener(data) {
    nextData = data;
    asap(flush);
  }

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