2016-05-20 17:06:25 +00:00
|
|
|
"use strict";
|
|
|
|
/// <reference path="./typings/index.d.ts" />
|
2016-05-20 17:44:52 +00:00
|
|
|
var colors = require("colors");
|
|
|
|
var readline = require("readline");
|
|
|
|
var rl = readline.createInterface({
|
|
|
|
input: process.stdin,
|
|
|
|
output: process.stdout
|
|
|
|
});
|
2016-05-21 18:33:13 +00:00
|
|
|
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 abort = true;
|
|
|
|
var logEarly = function () {
|
|
|
|
rl.write(null, { ctrl: true, name: 'u' });
|
|
|
|
rl.write(makeFrame());
|
2016-05-20 17:44:52 +00:00
|
|
|
setTimeout(function () {
|
2016-05-21 18:33:13 +00:00
|
|
|
if (!abort) {
|
|
|
|
logEarly();
|
|
|
|
}
|
|
|
|
}, 200);
|
|
|
|
};
|
|
|
|
// exports
|
|
|
|
exports.start = function (moduleNameArg, loaderLengthArg) {
|
|
|
|
if (loaderLengthArg === void 0) { loaderLengthArg = 10; }
|
|
|
|
abort = false;
|
|
|
|
moduleName = moduleNameArg;
|
|
|
|
loaderLength = loaderLengthArg;
|
|
|
|
logEarly();
|
2016-05-20 17:06:25 +00:00
|
|
|
};
|
|
|
|
exports.stop = function () {
|
2016-05-21 18:33:13 +00:00
|
|
|
abort = true;
|
|
|
|
rl.write(null, { ctrl: true, name: 'u' });
|
|
|
|
rl.close();
|
2016-05-20 17:06:25 +00:00
|
|
|
};
|
|
|
|
|
2016-05-21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