-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
126 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
|
||
export default { | ||
input: 'lib/esm/index.js', | ||
output: 'lib/umd/index.js', | ||
output: { | ||
name: 'Elapssed-logger', | ||
name: 'Elapsed_logger', | ||
file: 'lib/umd/index.js', | ||
format: 'umd', | ||
exports: "named", | ||
globals: { | ||
'browser-hrtime': 'hrtime', | ||
} | ||
}, | ||
external: [ 'browser-hrtime' ] | ||
plugins: [resolve()] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<!-- <script crossorigin src="https://unpkg.com/browser-hrtime/lib/umd/index.js"></script> --> | ||
<!-- <script crossorigin src="https://unpkg.com/elapsed-time-logger/lib/umd/index.js"></script> --> | ||
<script src="../lib/umd/index.js"></script> | ||
<script> | ||
var elapsed = Elapsed_logger; | ||
elapsed.start('test2'); | ||
setTimeout(()=>{ | ||
elapsed.end('test2'); | ||
}, 1300); | ||
|
||
|
||
elapsed.start('test'); | ||
setTimeout(()=>{ | ||
elapsed.end('test'); | ||
}, 1300); | ||
|
||
elapsed.start('testoverride'); | ||
setTimeout(()=>{ | ||
elapsed.end('testoverride', 'override label'); | ||
}, 100); | ||
|
||
|
||
elapsed.start('vlad'); | ||
setTimeout(()=>{ | ||
const test = elapsed.get('vlad'); | ||
console.log(test); | ||
}, 1200); | ||
|
||
// ElapsedLogger is similliar to console.time() & console.timeEnd() | ||
elapsed.start('label'); | ||
elapsed.start('timer label'); | ||
setTimeout(()=>{ | ||
elapsed.end('label'); | ||
elapsed.end('timer label'); | ||
}, 800); | ||
|
||
|
||
// or use ElapsedLogger as an instance (recommended) | ||
const elapsedTimer = elapsed.start(); | ||
// const elapsedTimer2 = elapsed.start(); | ||
console.log('smth'); | ||
setTimeout(()=>{ | ||
const t = elapsedTimer.get(); | ||
console.log(t); | ||
// elapsedTimer2.end(chalk.green('you can use colors here, try chalk or colors packages:')); | ||
elapsedTimer.end('finished:'); | ||
}, 800); | ||
|
||
|
||
</script> | ||
</head> | ||
|
||
<body> | ||
</body> | ||
|
||
</html> |