diff --git a/dist/early.child.d.ts b/dist/early.child.d.ts deleted file mode 100644 index 317822d..0000000 --- a/dist/early.child.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'typings-global'; diff --git a/dist/early.child.js b/dist/early.child.js deleted file mode 100644 index dbf7698..0000000 --- a/dist/early.child.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; -require("typings-global"); -const chalk = require("chalk"); -const readline = require("readline"); -let rl = readline.createInterface({ - input: process.stdin, - output: process.stdout -}); -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; -}; -let logEarlyAbort = false; -let logEarly = () => { - if (!logEarlyAbort) { - rl.write(null, { ctrl: true, name: 'u' }); - rl.write(makeFrame()); - setTimeout(function () { - logEarly(); - }, 80); - } - else { - rl.write(null, { ctrl: true, name: 'u' }); - rl.close(); - setTimeout(function () { - process.exit(0); - }, 80); - } -}; -let start = function (moduleNameArg = '', loaderLengthArg = '10') { - moduleName = moduleNameArg; - loaderLength = parseInt(loaderLengthArg); - logEarly(); -}; -process.on('SIGINT', () => { - logEarlyAbort = true; -}); -start(); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWFybHkuY2hpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9lYXJseS5jaGlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLCtCQUErQjtBQUMvQixxQ0FBcUM7QUFDckMsSUFBSSxFQUFFLEdBQUcsUUFBUSxDQUFDLGVBQWUsQ0FBQztJQUM5QixLQUFLLEVBQUUsT0FBTyxDQUFDLEtBQUs7SUFDcEIsTUFBTSxFQUFFLE9BQU8sQ0FBQyxNQUFNO0NBQ3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0FBQyxJQUFJLEVBQUUsRUFBRSxJQUFJLEVBQUUsSUFBSSxFQUFFLElBQUksRUFBRSxHQUFHLEVBQUUsQ0FBQyxDQUFBO1FBQ3pDLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUNWLFVBQVUsQ0FBQztZQUNQLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFDbkIsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFBO0lBQ1YsQ0FBQztBQUNMLENBQUMsQ0FBQTtBQUVELElBQUksS0FBSyxHQUFHLFVBQVUsYUFBYSxHQUFXLEVBQUUsRUFBRSxlQUFlLEdBQVcsSUFBSTtJQUM1RSxVQUFVLEdBQUcsYUFBYSxDQUFBO0lBQzFCLFlBQVksR0FBRyxRQUFRLENBQUMsZUFBZSxDQUFDLENBQUE7SUFDeEMsUUFBUSxFQUFFLENBQUE7QUFDZCxDQUFDLENBQUE7QUFFRCxPQUFPLENBQUMsRUFBRSxDQUFDLFFBQVEsRUFBRTtJQUNqQixhQUFhLEdBQUcsSUFBSSxDQUFBO0FBQ3hCLENBQUMsQ0FBQyxDQUFBO0FBRUYsS0FBSyxFQUFFLENBQUEifQ== \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts index 4612b8c..8e7a416 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,5 +1,8 @@ /// import 'typings-global'; import q = require('q'); +/** + * start the loading + */ export declare let start: (moduleNameArg?: string, loaderLengthArg?: string) => void; export declare let stop: () => q.Promise; diff --git a/dist/index.js b/dist/index.js index 2888afc..cec3975 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,34 +1,19 @@ "use strict"; require("typings-global"); -const path = require("path"); const chalk = require("chalk"); const q = require("q"); -const childProcess = require("child_process"); -let earlyChild; -let doAnimation = true; let doText = false; let moduleName = 'undefined module name'; -let startTime; -if (process.argv.indexOf('-v') !== -1 || process.env.CI) { - doAnimation = false; -} -if (process.argv.indexOf('-v') === -1 && process.env.CI) { +let startTime = Date.now(); +if (process.argv.indexOf('-v') === -1) { doText = true; } -// exports +/** + * start the loading + */ exports.start = function (moduleNameArg = '', loaderLengthArg = '10') { - startTime = Date.now(); moduleName = moduleNameArg; - if (doAnimation) { - earlyChild = childProcess.fork(path.join(__dirname, 'early.child.js'), [], { - env: { - moduleNameArg: moduleNameArg, - loaderLengthArg: loaderLengthArg, - CI: process.env.CI - } - }); - } - else if (doText) { + if (doText) { console.log(`**** starting ${chalk.green(moduleNameArg)} ****`); } }; @@ -37,17 +22,8 @@ exports.stop = () => { let endTime = Date.now(); let earlyExecutionTime = (endTime - startTime); let earlyExecutionTimeString = (earlyExecutionTime / 1000).toString(); - if (doAnimation) { - earlyChild.kill('SIGINT'); - earlyChild.on('close', function () { - console.log(`loaded ${chalk.green(moduleName)} in ${earlyExecutionTimeString} seconds!`); - done.resolve(earlyExecutionTime); - }); - } - else { - console.log(`... finished loading ${moduleName} in ${earlyExecutionTimeString}`); - done.resolve(earlyExecutionTime); - } + console.log(`... finished loading ${moduleName} in ${earlyExecutionTimeString}`); + done.resolve(earlyExecutionTime); return done.promise; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLDZCQUE2QjtBQUM3QiwrQkFBK0I7QUFDL0IsdUJBQXVCO0FBQ3ZCLDhDQUE4QztBQUM5QyxJQUFJLFVBQVUsQ0FBQTtBQUVkLElBQUksV0FBVyxHQUFZLElBQUksQ0FBQTtBQUMvQixJQUFJLE1BQU0sR0FBWSxLQUFLLENBQUE7QUFDM0IsSUFBSSxVQUFVLEdBQVcsdUJBQXVCLENBQUE7QUFDaEQsSUFBSSxTQUFTLENBQUE7QUFFYixFQUFFLENBQUM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xHQUFHLFNBQVMsQ0FBQyxDQUFBO0lBQ3RELElBQUksd0JBQXdCLEdBQVcsQ0FBQyxrQkFBa0IsR0FBRyxJQUFJLENBQUMsQ0FBQyxRQUFRLEVBQUUsQ0FBQTtJQUM3RSxPQUFPLENBQUMsR0FBRyxDQUFDLHdCQUF3QixVQUFVLE9BQU8sd0JBQXdCLEVBQUUsQ0FBQyxDQUFBO0lBQ2hGLElBQUksQ0FBQyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQTtJQUNoQyxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtBQUN2QixDQUFDLENBQUEifQ== \ No newline at end of file diff --git a/pages/api/assets/js/search.js b/pages/api/assets/js/search.js index 5b620c3..4da7463 100644 --- a/pages/api/assets/js/search.js +++ b/pages/api/assets/js/search.js @@ -1 +1 @@ -var typedoc = typedoc || {};typedoc.search = typedoc.search || {};typedoc.search.data = {"kinds":{"1":"External module","32":"Variable","64":"Function"},"rows":[{"id":0,"kind":1,"name":"\"ts/early.child\"","url":"modules/_ts_early_child_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":32,"name":"rl","url":"modules/_ts_early_child_.html#rl","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/early.child\""},{"id":2,"kind":32,"name":"moduleName","url":"modules/_ts_early_child_.html#modulename","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/early.child\""},{"id":3,"kind":32,"name":"loaderLength","url":"modules/_ts_early_child_.html#loaderlength","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/early.child\""},{"id":4,"kind":32,"name":"frameCounter","url":"modules/_ts_early_child_.html#framecounter","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/early.child\""},{"id":5,"kind":64,"name":"makeFrame","url":"modules/_ts_early_child_.html#makeframe","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/early.child\""},{"id":6,"kind":32,"name":"logEarlyAbort","url":"modules/_ts_early_child_.html#logearlyabort","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/early.child\""},{"id":7,"kind":64,"name":"logEarly","url":"modules/_ts_early_child_.html#logearly","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/early.child\""},{"id":8,"kind":64,"name":"start","url":"modules/_ts_early_child_.html#start","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/early.child\""},{"id":9,"kind":1,"name":"\"ts/index\"","url":"modules/_ts_index_.html","classes":"tsd-kind-external-module"},{"id":10,"kind":32,"name":"earlyChild","url":"modules/_ts_index_.html#earlychild","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/index\""},{"id":11,"kind":32,"name":"doAnimation","url":"modules/_ts_index_.html#doanimation","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/index\""},{"id":12,"kind":32,"name":"doText","url":"modules/_ts_index_.html#dotext","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/index\""},{"id":13,"kind":32,"name":"moduleName","url":"modules/_ts_index_.html#modulename","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/index\""},{"id":14,"kind":32,"name":"startTime","url":"modules/_ts_index_.html#starttime","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/index\""},{"id":15,"kind":64,"name":"start","url":"modules/_ts_index_.html#start","classes":"tsd-kind-function tsd-parent-kind-external-module","parent":"\"ts/index\""},{"id":16,"kind":64,"name":"stop","url":"modules/_ts_index_.html#stop","classes":"tsd-kind-function tsd-parent-kind-external-module","parent":"\"ts/index\""}]}; \ No newline at end of file +var typedoc = typedoc || {};typedoc.search = typedoc.search || {};typedoc.search.data = {"kinds":{"1":"External module","32":"Variable","64":"Function"},"rows":[{"id":0,"kind":1,"name":"\"ts/index\"","url":"modules/_ts_index_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":32,"name":"doText","url":"modules/_ts_index_.html#dotext","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/index\""},{"id":2,"kind":32,"name":"moduleName","url":"modules/_ts_index_.html#modulename","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/index\""},{"id":3,"kind":32,"name":"startTime","url":"modules/_ts_index_.html#starttime","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"ts/index\""},{"id":4,"kind":64,"name":"start","url":"modules/_ts_index_.html#start","classes":"tsd-kind-function tsd-parent-kind-external-module","parent":"\"ts/index\""},{"id":5,"kind":64,"name":"stop","url":"modules/_ts_index_.html#stop","classes":"tsd-kind-function tsd-parent-kind-external-module","parent":"\"ts/index\""}]}; \ No newline at end of file diff --git a/pages/api/file.json b/pages/api/file.json index 33acc2d..b56d065 100644 --- a/pages/api/file.json +++ b/pages/api/file.json @@ -24,62 +24,25 @@ }, { "id": 2, - "name": "\"ts/early.child\"", + "name": "\"ts/index\"", "kind": 1, "kindString": "External module", "flags": { "isExported": true }, - "originalName": "/Users/philkunz/gitlab/pushrocks/early/ts/early.child.ts", + "originalName": "/Users/philkunz/gitlab/pushrocks/early/ts/index.ts", "children": [ { - "id": 6, - "name": "frameCounter", + "id": 3, + "name": "doText", "kind": 32, "kindString": "Variable", "flags": {}, "sources": [ { - "fileName": "ts/early.child.ts", - "line": 11, - "character": 16 - } - ], - "type": { - "type": "instrinct", - "name": "number" - }, - "defaultValue": "0" - }, - { - "id": 5, - "name": "loaderLength", - "kind": 32, - "kindString": "Variable", - "flags": {}, - "sources": [ - { - "fileName": "ts/early.child.ts", - "line": 10, - "character": 16 - } - ], - "type": { - "type": "instrinct", - "name": "number" - } - }, - { - "id": 9, - "name": "logEarlyAbort", - "kind": 32, - "kindString": "Variable", - "flags": {}, - "sources": [ - { - "fileName": "ts/early.child.ts", - "line": 23, - "character": 17 + "fileName": "ts/index.ts", + "line": 7, + "character": 10 } ], "type": { @@ -94,251 +57,10 @@ "kind": 32, "kindString": "Variable", "flags": {}, - "sources": [ - { - "fileName": "ts/early.child.ts", - "line": 9, - "character": 14 - } - ], - "type": { - "type": "instrinct", - "name": "string" - } - }, - { - "id": 3, - "name": "rl", - "kind": 32, - "kindString": "Variable", - "flags": {}, - "sources": [ - { - "fileName": "ts/early.child.ts", - "line": 4, - "character": 6 - } - ], - "type": { - "type": "instrinct", - "name": "unknown" - }, - "defaultValue": " readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})" - }, - { - "id": 10, - "name": "logEarly", - "kind": 64, - "kindString": "Function", - "flags": {}, - "signatures": [ - { - "id": 11, - "name": "logEarly", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "instrinct", - "name": "void" - } - } - ], - "sources": [ - { - "fileName": "ts/early.child.ts", - "line": 24, - "character": 12 - } - ] - }, - { - "id": 7, - "name": "makeFrame", - "kind": 64, - "kindString": "Function", - "flags": {}, - "signatures": [ - { - "id": 8, - "name": "makeFrame", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "instrinct", - "name": "string" - } - } - ], - "sources": [ - { - "fileName": "ts/early.child.ts", - "line": 13, - "character": 13 - } - ] - }, - { - "id": 12, - "name": "start", - "kind": 64, - "kindString": "Function", - "flags": {}, - "signatures": [ - { - "id": 13, - "name": "start", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 14, - "name": "moduleNameArg", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "instrinct", - "name": "string" - }, - "defaultValue": "\"\"" - }, - { - "id": 15, - "name": "loaderLengthArg", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "instrinct", - "name": "string" - }, - "defaultValue": "\"10\"" - } - ], - "type": { - "type": "instrinct", - "name": "void" - } - } - ], - "sources": [ - { - "fileName": "ts/early.child.ts", - "line": 40, - "character": 9 - } - ] - } - ], - "groups": [ - { - "title": "Variables", - "kind": 32, - "children": [ - 6, - 5, - 9, - 4, - 3 - ] - }, - { - "title": "Functions", - "kind": 64, - "children": [ - 10, - 7, - 12 - ] - } - ], - "sources": [ - { - "fileName": "ts/early.child.ts", - "line": 1, - "character": 0 - } - ] - }, - { - "id": 16, - "name": "\"ts/index\"", - "kind": 1, - "kindString": "External module", - "flags": { - "isExported": true - }, - "originalName": "/Users/philkunz/gitlab/pushrocks/early/ts/index.ts", - "children": [ - { - "id": 18, - "name": "doAnimation", - "kind": 32, - "kindString": "Variable", - "flags": {}, "sources": [ { "fileName": "ts/index.ts", "line": 8, - "character": 15 - } - ], - "type": { - "type": "instrinct", - "name": "boolean" - }, - "defaultValue": "true" - }, - { - "id": 19, - "name": "doText", - "kind": 32, - "kindString": "Variable", - "flags": {}, - "sources": [ - { - "fileName": "ts/index.ts", - "line": 9, - "character": 10 - } - ], - "type": { - "type": "instrinct", - "name": "boolean" - }, - "defaultValue": "false" - }, - { - "id": 17, - "name": "earlyChild", - "kind": 32, - "kindString": "Variable", - "flags": {}, - "sources": [ - { - "fileName": "ts/index.ts", - "line": 6, - "character": 14 - } - ], - "type": { - "type": "instrinct", - "name": "any" - } - }, - { - "id": 20, - "name": "moduleName", - "kind": 32, - "kindString": "Variable", - "flags": {}, - "sources": [ - { - "fileName": "ts/index.ts", - "line": 10, "character": 14 } ], @@ -349,7 +71,7 @@ "defaultValue": "\"undefined module name\"" }, { - "id": 21, + "id": 5, "name": "startTime", "kind": 32, "kindString": "Variable", @@ -357,33 +79,40 @@ "sources": [ { "fileName": "ts/index.ts", - "line": 11, + "line": 9, "character": 13 } ], "type": { "type": "instrinct", - "name": "any" - } + "name": "number" + }, + "defaultValue": " Date.now()" }, { - "id": 22, + "id": 6, "name": "start", "kind": 64, "kindString": "Function", "flags": { "isExported": true }, + "comment": { + "shortText": "start the loading" + }, "signatures": [ { - "id": 23, + "id": 7, "name": "start", "kind": 4096, "kindString": "Call signature", "flags": {}, + "comment": { + "shortText": "start the loading" + }, "parameters": [ { - "id": 24, + "id": 8, "name": "moduleNameArg", "kind": 32768, "kindString": "Parameter", @@ -395,7 +124,7 @@ "defaultValue": "\"\"" }, { - "id": 25, + "id": 9, "name": "loaderLengthArg", "kind": 32768, "kindString": "Parameter", @@ -416,13 +145,13 @@ "sources": [ { "fileName": "ts/index.ts", - "line": 21, + "line": 18, "character": 16 } ] }, { - "id": 26, + "id": 10, "name": "stop", "kind": 64, "kindString": "Function", @@ -431,7 +160,7 @@ }, "signatures": [ { - "id": 27, + "id": 11, "name": "stop", "kind": 4096, "kindString": "Call signature", @@ -445,7 +174,7 @@ "sources": [ { "fileName": "ts/index.ts", - "line": 39, + "line": 25, "character": 15 } ] @@ -456,19 +185,17 @@ "title": "Variables", "kind": 32, "children": [ - 18, - 19, - 17, - 20, - 21 + 3, + 4, + 5 ] }, { "title": "Functions", "kind": 64, "children": [ - 22, - 26 + 6, + 10 ] } ], @@ -487,8 +214,7 @@ "kind": 1, "children": [ 1, - 2, - 16 + 2 ] } ] diff --git a/pages/api/globals.html b/pages/api/globals.html index b4d40c7..418b827 100644 --- a/pages/api/globals.html +++ b/pages/api/globals.html @@ -72,7 +72,6 @@ External modules "node_modules/typings-global/custom.d" - "ts/early.child" "ts/index" @@ -89,9 +88,6 @@ Internals - - "ts/early.child" - "ts/index" diff --git a/pages/api/index.html b/pages/api/index.html index 6a9f1ab..4a034f3 100644 --- a/pages/api/index.html +++ b/pages/api/index.html @@ -104,9 +104,6 @@ early.stop().then((loadingTime:number) => Internals - - "ts/early.child" - "ts/index" diff --git a/pages/api/modules/_node_modules_typings_global_custom_d_.html b/pages/api/modules/_node_modules_typings_global_custom_d_.html index 6b6fde7..d31244b 100644 --- a/pages/api/modules/_node_modules_typings_global_custom_d_.html +++ b/pages/api/modules/_node_modules_typings_global_custom_d_.html @@ -77,9 +77,6 @@ Internals - - "ts/early.child" - "ts/index" diff --git a/pages/api/modules/_ts_early_child_.html b/pages/api/modules/_ts_early_child_.html deleted file mode 100644 index da919bf..0000000 --- a/pages/api/modules/_ts_early_child_.html +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - "ts/early.child" | early - - - - - - - - - - - - - Search - - - - Preparing search index... - The search index is not available - - early - - - - Options - - - All - - Public - Public/Protected - All - - - - Inherited - - Externals - - Only exported - - - Menu - - - - - - - - - Globals - - - "ts/early.child" - - - External module "ts/early.child" - - - - - - - - Index - - - - Variables - - frameCounter - loaderLength - logEarlyAbort - moduleName - rl - - - - Functions - - logEarly - makeFrame - start - - - - - - - Variables - - - frameCounter - frameCounter: number = 0 - - - - - loaderLength - loaderLength: number - - - - - logEarlyAbort - logEarlyAbort: boolean = false - - - - - moduleName - moduleName: string - - - - - rl - rl: unknown = readline.createInterface({input: process.stdin,output: process.stdout}) - - - - - Functions - - - logEarly - - logEarly(): void - - - - - Returns void - - - - - - makeFrame - - makeFrame(): string - - - - - Returns string - - - - - - start - - start(moduleNameArg?: string, loaderLengthArg?: string): void - - - - - Parameters - - - Default value moduleNameArg: string = "" - - - Default value loaderLengthArg: string = "10" - - - Returns void - - - - - - - - - - Globals - - - Internals - - - "ts/early.child" - - - "ts/index" - - - Externals - - - "node_modules/typings-global/custom.d" - - - - - - - frameCounter - - - loaderLength - - - logEarlyAbort - - - moduleName - - - rl - - - logEarly - - - makeFrame - - - start - - - - - - - - - Generated using TypeDoc - - - - - - \ No newline at end of file diff --git a/pages/api/modules/_ts_index_.html b/pages/api/modules/_ts_index_.html index 3d469ef..c0f1dd9 100644 --- a/pages/api/modules/_ts_index_.html +++ b/pages/api/modules/_ts_index_.html @@ -74,9 +74,7 @@ Variables - doAnimation doText - earlyChild moduleName startTime @@ -93,33 +91,13 @@ Variables - - - doAnimation - doAnimation: boolean = true - - doText doText: boolean = false - - - - earlyChild - earlyChild: any - @@ -129,17 +107,17 @@ moduleName: string = "undefined module name" startTime - startTime: any + startTime: number = Date.now() @@ -156,9 +134,14 @@ + + + start the loading + + Parameters @@ -182,7 +165,7 @@ Returns q.Promise @@ -200,9 +183,6 @@ Internals - - "ts/early.child" - "ts/index" @@ -216,15 +196,9 @@ - - doAnimation - doText - - earlyChild - moduleName diff --git a/ts/early.child.ts b/ts/early.child.ts deleted file mode 100644 index 3d5a575..0000000 --- a/ts/early.child.ts +++ /dev/null @@ -1,50 +0,0 @@ -import 'typings-global' -import chalk = require('chalk') -import readline = require('readline') -let rl = readline.createInterface({ - input: process.stdin, - output: process.stdout -}) - -let moduleName: string -let loaderLength: number -let frameCounter: number = 0 - -let makeFrame = (): string => { - let resultString: string = `[${chalk.green('/'.repeat(frameCounter))}${' '.repeat(loaderLength - frameCounter)}] starting ${moduleName}` - if (frameCounter === loaderLength) { - frameCounter = 0 - } else { - frameCounter++ - } - return resultString -} - -let logEarlyAbort = false -let logEarly = () => { - if (!logEarlyAbort) { - rl.write(null, { ctrl: true, name: 'u' }) - rl.write(makeFrame()) - setTimeout(function () { - logEarly() - }, 80) - } else { - rl.write(null, { ctrl: true, name: 'u' }) - rl.close() - setTimeout(function () { - process.exit(0) - }, 80) - } -} - -let start = function (moduleNameArg: string = '', loaderLengthArg: string = '10') { - moduleName = moduleNameArg - loaderLength = parseInt(loaderLengthArg) - logEarly() -} - -process.on('SIGINT', () => { - logEarlyAbort = true -}) - -start() diff --git a/ts/index.ts b/ts/index.ts index 947bc63..7e28671 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -2,36 +2,22 @@ import 'typings-global' import path = require('path') import chalk = require('chalk') import q = require('q') -import childProcess = require('child_process') -let earlyChild -let doAnimation: boolean = true + let doText: boolean = false let moduleName: string = 'undefined module name' -let startTime +let startTime = Date.now() -if (process.argv.indexOf('-v') !== -1 || process.env.CI) { - doAnimation = false -} -if (process.argv.indexOf('-v') === -1 && process.env.CI) { +if (process.argv.indexOf('-v') === -1) { doText = true } -// exports +/** + * start the loading + */ export let start = function (moduleNameArg: string = '', loaderLengthArg: string = '10') { - - startTime = Date.now() - moduleName = moduleNameArg - if (doAnimation) { - earlyChild = childProcess.fork(path.join(__dirname, 'early.child.js'), [], { - env: { - moduleNameArg: moduleNameArg, - loaderLengthArg: loaderLengthArg, - CI: process.env.CI - } - }) - } else if (doText) { + if (doText) { console.log(`**** starting ${chalk.green(moduleNameArg)} ****`) } } @@ -41,15 +27,7 @@ export let stop = (): q.Promise => { let endTime = Date.now() let earlyExecutionTime: number = (endTime - startTime) let earlyExecutionTimeString: string = (earlyExecutionTime / 1000).toString() - if (doAnimation) { - earlyChild.kill('SIGINT') - earlyChild.on('close', function () { - console.log(`loaded ${chalk.green(moduleName)} in ${earlyExecutionTimeString} seconds!`) - done.resolve(earlyExecutionTime) - }) - } else { - console.log(`... finished loading ${moduleName} in ${earlyExecutionTimeString}`) - done.resolve(earlyExecutionTime) - } + console.log(`... finished loading ${moduleName} in ${earlyExecutionTimeString}`) + done.resolve(earlyExecutionTime) return done.promise }
Generated using TypeDoc
start the loading
start the loading
+