How to use the asap 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 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 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 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);
  }
github react-dnd / 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 necolas / react-native-web / src / apis / StyleSheet / injector.js View on Github external
const addRule = (key, rule) => {
  if (!registry[key]) {
    registry[key] = rule;
    isDirty = true;
    if (global.document) {
      asap(frame);
    }
  }
};
github mendersoftware / gui / node_modules / 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 callback(cb) {
    nextCallback = cb;
    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