now clearing correctly

This commit is contained in:
Philipp Kunz 2016-06-10 05:59:21 +02:00
parent 9829c7bb1e
commit fc7d7fd27f
4 changed files with 25 additions and 30 deletions

23
dist/early.child.js vendored
View File

@ -2,13 +2,10 @@
require("typings-global"); require("typings-global");
var colors = require("colors"); var colors = require("colors");
var readline = require("readline"); var readline = require("readline");
var rl; var rl = readline.createInterface({
var initReadline = function () { input: process.stdin,
rl = readline.createInterface({ output: process.stdout
input: process.stdin, });
output: process.stdout
});
};
var moduleName; var moduleName;
var loaderLength; var loaderLength;
var frameCounter = 0; var frameCounter = 0;
@ -27,11 +24,13 @@ var makeFrame = function () {
} }
return resultString; return resultString;
}; };
var logEarlyAbort = false;
var logEarly = function () { var logEarly = function () {
rl.write(null, { ctrl: true, name: 'u' }); rl.write(null, { ctrl: true, name: 'u' });
rl.write(makeFrame()); rl.write(makeFrame());
setTimeout(function () { setTimeout(function () {
logEarly(); if (!logEarlyAbort)
logEarly();
}, 80); }, 80);
}; };
var start = function (moduleNameArg, loaderLengthArg) { var start = function (moduleNameArg, loaderLengthArg) {
@ -39,9 +38,13 @@ var start = function (moduleNameArg, loaderLengthArg) {
if (loaderLengthArg === void 0) { loaderLengthArg = "10"; } if (loaderLengthArg === void 0) { loaderLengthArg = "10"; }
moduleName = moduleNameArg; moduleName = moduleNameArg;
loaderLength = parseInt(loaderLengthArg); loaderLength = parseInt(loaderLengthArg);
initReadline();
logEarly(); logEarly();
}; };
start(process.env.moduleNameArg, process.env.loaderLengthArg); start(process.env.moduleNameArg, process.env.loaderLengthArg);
process.on('SIGINT', function () {
logEarlyAbort = true;
rl.write(null, { ctrl: true, name: 'u' });
rl.close();
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImVhcmx5LmNoaWxkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsSUFBSSxNQUFNL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XQoZnVuY3Rpb24oKXtcbiAgICAgICAgaWYoIWxvZ0Vhcmx5QWJvcnQpIGxvZ0Vhcmx5KCk7XG4gICAgfSw4MCk7XG59O1xuXG5sZXQgc3RhcnQgPSBmdW5jdGlvbihtb2R1bGVOYW1lQXJnOnN0cmluZyA9IFwiXCIsbG9hZGVyTGVuZ3RoQXJnOnN0cmluZyA9IFwiMTBcIil7XG4gICAgbW9kdWxlTmFtZSA9IG1vZHVsZU5hbWVBcmc7XG4gICAgbG9hZGVyTGVuZ3RoID0gcGFyc2VJbnQobG9hZGVyTGVuZ3RoQXJnKTtcbiAgICBsb2dFYXJseSgpO1xufTtcblxuc3RhcnQocHJvY2Vzcy5lbnYubW9kdWxlTmFtZUFyZyxwcm9jZXNzLmVudi5sb2FkZXJMZW5ndGhBcmcpO1xuXG5wcm9jZXNzLm9uKCdTSUdJTlQnLCAoKSA9PiB7XG4gICAgbG9nRWFybHlBYm9ydCA9IHRydWU7XG4gICAgcmwud3JpdGUobnVsbCwge2N0cmw6IHRydWUsIG5hbWU6ICd1J30pO1xuICAgIHJsLmNsb3NlKCk7XG59KTsiXX0=

8
dist/index.js vendored
View File

@ -1,7 +1,6 @@
"use strict"; "use strict";
require("typings-global"); require("typings-global");
var path = require("path"); var path = require("path");
var readline = require("readline");
var childProcess = require("child_process"); var childProcess = require("child_process");
var earlyChild; var earlyChild;
var doAnimation = true; var doAnimation = true;
@ -32,12 +31,7 @@ exports.start = function (moduleNameArg, loaderLengthArg) {
exports.stop = function () { exports.stop = function () {
if (doAnimation) { if (doAnimation) {
earlyChild.kill(); earlyChild.kill();
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.close();
} }
}; };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFFdkIsSUFBT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lO1xuaWYocHJvY2Vzcy5hcmd2LmluZGV4T2YoXCItdlwiKSAhPSAtMSB8fCBwcm9jZXNzLmVudi5DSSl7XG4gICAgZG9BbmltYXRpb24gPSBmYWxzZTtcbn0gZWxzZSBpZihwcm9jZXNzLmFyZ3YuaW5kZXhPZihcIi12XCIpID09IC0xKXtcbiAgICBkb1RleHQgPSB0cnVlO1xufVxuXG4vLyBleHBvcnRzXG5leHBvcnQgbGV0IHN0YXJ0ID0gZnVuY3Rpb24obW9kdWxlTmFtZUFyZzpzdHJpbmcgPSBcIlwiLGxvYWRlckxlbmd0aEFyZzpzdHJpbmcgPSBcIjEwXCIpe1xuICAgIGlmKGRvQW5pbWF0aW9uKXtcbiAgICAgICAgZWFybHlDaGlsZCA9IGNoaWxkUHJvY2Vzcy5mb3JrKHBhdGguam9pbihfX2Rpcm5hbWUsXCJlYXJseS5jaGlsZC5qc1wiKSxbXSx7XG4gICAgICAgICAgICBlbnY6IHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lQXJnOm1vZHVsZU5hbWVBcmcsXG4gICAgICAgICAgICAgICAgbG9hZGVyTGVuZ3RoQXJnOmxvYWRlckxlbmd0aEFyZyxcbiAgICAgICAgICAgICAgICBDSTogcHJvY2Vzcy5lbnYuQ0lcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfSBlbHNlIGlmIChkb1RleHQpIHtcbiAgICAgICAgY29uc29sZS5sb2coXCIqKioqIHN0YXJ0aW5nIFwiICsgbW9kdWxlTmFtZUFyZy5jeWFuICsgXCIgKioqKlwiKTtcbiAgICB9XG59O1xuXG5leHBvcnQgbGV0IHN0b3AgPSBmdW5jdGlvbigpe1xuICAgIGlmKGRvQW5pbWF0aW9uKXtcbiAgICAgICAgZWFybHlDaGlsZC5raWxsKCk7XG4gICAgfVxufTtcblxuIl19

View File

@ -1,13 +1,10 @@
import "typings-global"; import "typings-global";
let colors = require("colors"); let colors = require("colors");
import readline = require("readline"); import readline = require("readline");
let rl; let rl = readline.createInterface({
let initReadline = () => {
rl = readline.createInterface({
input: process.stdin, input: process.stdin,
output: process.stdout output: process.stdout
}); });
};
let moduleName:string; let moduleName:string;
let loaderLength:number; let loaderLength:number;
@ -29,19 +26,25 @@ let makeFrame = ():string => {
return resultString; return resultString;
}; };
let logEarlyAbort = false;
let logEarly = () => { let logEarly = () => {
rl.write(null, {ctrl: true, name: 'u'}); rl.write(null, {ctrl: true, name: 'u'});
rl.write(makeFrame()); rl.write(makeFrame());
setTimeout(function(){ setTimeout(function(){
logEarly(); if(!logEarlyAbort) logEarly();
},80); },80);
}; };
let start = function(moduleNameArg:string = "",loaderLengthArg:string = "10"){ let start = function(moduleNameArg:string = "",loaderLengthArg:string = "10"){
moduleName = moduleNameArg; moduleName = moduleNameArg;
loaderLength = parseInt(loaderLengthArg); loaderLength = parseInt(loaderLengthArg);
initReadline();
logEarly(); logEarly();
}; };
start(process.env.moduleNameArg,process.env.loaderLengthArg); start(process.env.moduleNameArg,process.env.loaderLengthArg);
process.on('SIGINT', () => {
logEarlyAbort = true;
rl.write(null, {ctrl: true, name: 'u'});
rl.close();
});

View File

@ -31,11 +31,6 @@ export let start = function(moduleNameArg:string = "",loaderLengthArg:string = "
export let stop = function(){ export let stop = function(){
if(doAnimation){ if(doAnimation){
earlyChild.kill(); earlyChild.kill();
let rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.close();
} }
}; };