early/dist/early.child.js

54 lines
5.1 KiB
JavaScript
Raw Normal View History

"use strict";
2016-06-10 03:18:03 +00:00
require("typings-global");
var colors = require("colors");
var readline = require("readline");
var rl;
var initReadline = function () {
rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
};
var moduleName;
var loaderLength;
var frameCounter = 0;
var makeFrame = function () {
var resultString = "["
+ "/".green.repeat(frameCounter)
+ " ".repeat(loaderLength - frameCounter)
+ "]"
+ " starting "
+ moduleName.cyan;
if (frameCounter == loaderLength) {
frameCounter = 0;
}
else {
frameCounter++;
}
return resultString;
};
var logEarly = function () {
rl.write(null, { ctrl: true, name: 'u' });
rl.write(makeFrame());
setTimeout(function () {
logEarly();
2016-05-23 03:11:03 +00:00
}, 80);
};
var start = function (moduleNameArg, loaderLengthArg) {
if (moduleNameArg === void 0) { moduleNameArg = ""; }
if (loaderLengthArg === void 0) { loaderLengthArg = "10"; }
moduleName = moduleNameArg;
loaderLength = parseInt(loaderLengthArg);
2016-05-23 03:11:03 +00:00
if (process.env.CI == "undefined") {
initReadline();
logEarly();
}
else {
console.log("**** starting " + moduleName.cyan + " ****");
}
;
};
start(process.env.moduleNameArg, process.env.loaderLengthArg);
2016-06-10 03:18:03 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImVhcmx5LmNoaWxkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQy9CLElBQU8sUUFBUSxXQUFXLFVBQVUsQ0FBQyxDQUFDO0FBQ3RDLElBQUksRUFBRSxDQUFDO0FBQ1AsSUFBSSxZQUFZLEdBQUc7SUFDZixFQUFFLEdBQUcsUUFBUSxDQUFDLGVBQWUsQ0FBQztRQUM5QixLQUFLLEVBQUUsT0FBTyxDQUFDLEt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