electron-devtools-vendor
Version:
<div align="center"> <h2>electron-devtools-vendor</h2> <img alt="MIT" src="https://img.shields.io/github/license/BlackHole1/electron-devtools-vendor?color=9cf&style=flat-square"> <img alt="GitHub repo size" src="https://img.shields.io/github/r
32 lines (26 loc) • 786 B
JavaScript
// Small library for splitting cpu intensive javascript code into small chunks
// in order to not block the user interface.
define(["underscore"], function(_) {
var defer = new (function() {
this.initialize = function() {
this.queue = [];
};
this.add = function(func) {
this.queue.push(func);
if (this.queue.length == 1) {
// do first
setTimeout(this.doNext, 0);
}
};
this.doNext = function() {
var next = this.queue.shift();
next();
if (this.queue.length !== 0) {
// do next
setTimeout(this.doNext, 0);
}
};
this.initialize();
})();
return defer;
});