2016-05-20 17:06:25 +00:00
|
|
|
"use strict";
|
2017-03-26 20:01:33 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2016-09-18 21:11:26 +00:00
|
|
|
require("typings-global");
|
2017-02-17 17:56:58 +00:00
|
|
|
const beautycolor = require("beautycolor");
|
|
|
|
const smartq = require("smartq");
|
2017-04-23 18:57:01 +00:00
|
|
|
const early_hrtMeasurement_1 = require("./early.hrtMeasurement");
|
|
|
|
exports.HrtMeasurement = early_hrtMeasurement_1.HrtMeasurement;
|
2016-08-20 05:03:49 +00:00
|
|
|
let doText = false;
|
2016-09-15 12:45:58 +00:00
|
|
|
let moduleName = 'undefined module name';
|
2017-04-23 18:57:01 +00:00
|
|
|
let startHrt;
|
2016-09-18 22:34:38 +00:00
|
|
|
if (process.argv.indexOf('-v') === -1) {
|
2016-06-10 03:36:06 +00:00
|
|
|
doText = true;
|
|
|
|
}
|
2016-09-18 22:34:38 +00:00
|
|
|
/**
|
|
|
|
* start the loading
|
|
|
|
*/
|
2016-09-15 12:45:58 +00:00
|
|
|
exports.start = function (moduleNameArg = '', loaderLengthArg = '10') {
|
2016-08-20 05:03:49 +00:00
|
|
|
moduleName = moduleNameArg;
|
2017-04-23 18:57:01 +00:00
|
|
|
startHrt = new early_hrtMeasurement_1.HrtMeasurement();
|
|
|
|
startHrt.start();
|
2016-09-18 22:34:38 +00:00
|
|
|
if (doText) {
|
2017-02-17 17:56:58 +00:00
|
|
|
console.log(`**** starting ${beautycolor.coloredString(moduleNameArg, 'green')} ****`);
|
2016-06-10 03:36:06 +00:00
|
|
|
}
|
2016-05-20 17:06:25 +00:00
|
|
|
};
|
2016-09-15 12:45:58 +00:00
|
|
|
exports.stop = () => {
|
2017-02-17 17:56:58 +00:00
|
|
|
let done = smartq.defer();
|
2017-04-23 18:57:01 +00:00
|
|
|
let earlyExecutionTime = startHrt.stop().milliSeconds;
|
2016-09-15 12:59:22 +00:00
|
|
|
let earlyExecutionTimeString = (earlyExecutionTime / 1000).toString();
|
2017-03-26 20:01:33 +00:00
|
|
|
console.log(`OK! -> finished loading within ${beautycolor.coloredString(earlyExecutionTimeString, 'blue')}`);
|
2016-09-18 22:34:38 +00:00
|
|
|
done.resolve(earlyExecutionTime);
|
2016-06-11 21:53:48 +00:00
|
|
|
return done.promise;
|
2016-05-20 17:06:25 +00:00
|
|
|
};
|
2017-04-23 18:57:01 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QiwyQ0FBMEM7QUFDMUMsaUNBQWdDO0FBQ2hDLGlFQUF1RDtBQUdyRCx5QkFITyxxQ0FBYyxDQUdQO0FBR2hCLElBQUksTUFBTSxHQUFZLEtBQUssQ0FBQTtBQUMzQixJQUFJLFVBQVUsR0FBVyx1QkFBdUIsQ0FBQTtBQUNoRCxJQUFJLFFBQXdCLENBQUE7QUFFNUIsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ3RDLE1BQU0sR0FBRyxJQUFJLENBQUE7QUFDZixDQUFDO0FBRUQ7O0dBRUc7QUFDUSxRQUFBLEtBQUssR0FBRyxVQUFVLGdCQUF3QixFQUFFLEVBQUUsa0JBQTBCLElBQUk7SUFDckYsVUFBVSxHQUFHLGFBQWEsQ0FBQTtJQUMxQixRQUFRLEdBQUcsSUFBSSxxQ0FBYyxFQUFFLENBQUE7SUFDL0IsUUFBUSxDQUFDLEtBQUssRUFBRSxDQUFBO0lBQ2hCLEVBQUUsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7UUFDWCxPQUFPLENBQUMsR0FBRy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