Skip to content

Commit

Permalink
typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
vltansky committed Apr 27, 2020
1 parent 19f37b8 commit ccd5342
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/cjs/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var hrtime = require('browser-hrtime');
var browser_hrtime_1 = require("browser-hrtime");
var ElapsedLogger = /** @class */ (function () {
function ElapsedLogger() {
this._timer = hrtime();
this._timer = browser_hrtime_1.default();
}
ElapsedLogger.prototype.end = function (label) {
if (label === void 0) { label = ''; }
var elapsedTime = this.get();
console.log("" + (label ? label + ' ' : '') + elapsedTime);
};
ElapsedLogger.prototype._diff = function () {
return hrtime(this._timer);
return browser_hrtime_1.default(this._timer);
};
ElapsedLogger.prototype.get = function () {
var diff = this._diff();
Expand Down
2 changes: 1 addition & 1 deletion lib/es2015/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const hrtime = require('browser-hrtime');
import hrtime from 'browser-hrtime';
class ElapsedLogger {
constructor() {
this._timer = hrtime();
Expand Down
2 changes: 1 addition & 1 deletion lib/esm/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var hrtime = require('browser-hrtime');
import hrtime from 'browser-hrtime';
var ElapsedLogger = /** @class */ (function () {
function ElapsedLogger() {
this._timer = hrtime();
Expand Down
2 changes: 1 addition & 1 deletion lib/umd/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build:es2015": "tsc --module es2015 --target es2015 --outDir lib/es2015",
"build:esm": "tsc --module es2015 --target es5 --outDir lib/esm",
"build:cjs": "tsc --module commonjs --target es5 --outDir lib/cjs",
"build:umd": "rollup lib/esm/index.js --format umd --name Elapsed_logger --sourceMap --file lib/umd/index.js --exports named",
"build:umd": "rollup -c",
"build:umd:min": "cd lib/umd && terser --compress --mangle --comments -o index.js -- index.js",
"watch": "tsc --watch",
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.ts\"",
Expand Down
14 changes: 14 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
input: 'lib/esm/index.js',
output: 'lib/umd/index.js',
output: {
name: 'Elapssed-logger',
file: 'lib/umd/index.js',
format: 'umd',
exports: "named",
globals: {
'browser-hrtime': 'hrtime',
}
},
external: [ 'browser-hrtime' ]
};
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const hrtime = require('browser-hrtime');
import hrtime from 'browser-hrtime';
interface IElapsedLogger {
end(label?: string): void;
get(): string;
Expand Down

0 comments on commit ccd5342

Please sign in to comment.