early/dist/early.child.js

45 lines
3.0 KiB
JavaScript
Raw Normal View History

"use strict";
2016-06-10 03:18:03 +00:00
require("typings-global");
2016-08-20 05:03:49 +00:00
const chalk = require("chalk");
const readline = require("readline");
let rl = readline.createInterface({
2016-06-10 03:59:21 +00:00
input: process.stdin,
output: process.stdout
});
2016-08-20 05:03:49 +00:00
let moduleName;
let loaderLength;
let frameCounter = 0;
let makeFrame = () => {
let resultString = `[${chalk.green('/'.repeat(frameCounter))}${' '.repeat(loaderLength - frameCounter)}] starting ${moduleName}`;
if (frameCounter === loaderLength) {
frameCounter = 0;
}
else {
frameCounter++;
}
return resultString;
};
2016-08-20 05:03:49 +00:00
let logEarlyAbort = false;
let logEarly = () => {
if (!logEarlyAbort) {
rl.write(null, { ctrl: true, name: 'u' });
rl.write(makeFrame());
setTimeout(function () {
2016-06-10 03:59:21 +00:00
logEarly();
2016-08-20 05:03:49 +00:00
}, 80);
}
else {
readline.clearLine(process.stdout, 0);
process.exit(0);
}
};
let start = function (moduleNameArg = '', loaderLengthArg = '10') {
moduleName = moduleNameArg;
loaderLength = parseInt(loaderLengthArg);
2016-06-10 03:36:06 +00:00
logEarly();
};
2016-08-20 05:41:56 +00:00
process.on('SIGINT', () => {
2016-06-10 03:59:21 +00:00
logEarlyAbort = true;
});
start();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWFybHkuY2hpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9lYXJseS5jaGlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLCtCQUErQjtBQUMvQixxQ0FBcUM7QUFDckMsSUFBSSxFQUFFLEdBQUcsUUFBUSxDQUFDLGVBQWUsQ0FBQztJQUM5QixLQUFLLEVBQUUsT0FBTyxDQUFDLEtBQUs7SUFDcEIsTUFBTSxFQUFFLE9BQU8sQ0FBQyxNQUFNO0NBQ3pCLEN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