How to use the process.nextTick function in process

To help you get started, we’ve selected a few process 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 uber / uncaught-exception / test / uncaught.js View on Github external
fatal: function fatal() {
            // simulate a bug
            process.nextTick(function throwIt() {
                throw new Error('bug in logger implementation');
            });
        }
    };
github lixinliang / tree-view-search-bar / lib / view.js View on Github external
destroy () {
        // remove the element
        let destroy = () => {
            this.items = null;
            this.treeView = null;
            this.observer.disconnect();
            this.observer = null;
            this.unbindEvent();
            this.element.remove();
        };
        if (this.creating) {
            process.nextTick(() => {
                destroy();
            });
        } else {
            destroy();
        }
    }
github calvinmetcalf / rollup-plugin-node-builtins / src / es6 / readable-stream / readable.js View on Github external
function endReadable(stream) {
  var state = stream._readableState;

  // If we get here before consuming all the bytes, then that is a
  // bug in node.  Should never happen.
  if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');

  if (!state.endEmitted) {
    state.ended = true;
    nextTick(endReadableNT, state, stream);
  }
}
github uber / uncaught-exception / test / uncaught.js View on Github external
reporter.once('reportPostStatsd', function onEvent() {
        process.nextTick(function advance() {
            timer.advance(10);
        });
    });
github calvinmetcalf / rollup-plugin-node-builtins / src / es6 / readable-stream / readable.js View on Github external
function resume(stream, state) {
  if (!state.resumeScheduled) {
    state.resumeScheduled = true;
    nextTick(resume_, stream, state);
  }
}
github calvinmetcalf / rollup-plugin-node-builtins / src / es6 / readable-stream / readable.js View on Github external
function emitReadable(stream) {
  var state = stream._readableState;
  state.needReadable = false;
  if (!state.emittedReadable) {
    debug('emitReadable', state.flowing);
    state.emittedReadable = true;
    if (state.sync) nextTick(emitReadable_, stream);else emitReadable_(stream);
  }
}
github jtangelder / react-flux-backbone / src / components / App.js View on Github external
ensureBodyComponent: function(route, component) {
        process.nextTick(function() {
            this.setState({
                route: route,
                bodyComponent: component
            });
        }.bind(this));
    },
github malte-wessel / react-textfit / src / utils / series.js View on Github external
function done(err) {
        function end() {
            if (cb) cb(err, results);
        }
        if (isSync) process.nextTick(end);
        else end();
    }
github Raynos / leaked-handles / index.js View on Github external
set: function set(opts) {
        mutableExtend(mutableConfig, opts);

        if ('timeout' in opts) {
            printHandle.INTERVAL_HANDLE_TIMEOUT = opts.timeout +
                Math.floor(Math.random() * 100);
        }

        return this;
    },
    printHandles: function $printHandles() {
        printHandles(console, mutableConfig);
    }
};

process.nextTick(function onTick() {
    var timeoutHandle = setTimeout(function handleInspectionLoop() {
        printHandles(console, mutableConfig);

        timeoutHandle = setTimeout(handleInspectionLoop,
            printHandle.INTERVAL_HANDLE_TIMEOUT);
        timeoutHandle.unref();
    }, printHandle.INTERVAL_HANDLE_TIMEOUT);
    timeoutHandle.unref();
});