npm.io
0.0.5 • Published 10 years ago

timelane

Licence
ISC
Version
0.0.5
Deps
0
Vulns
0
Weekly
0
Stars
1

Use it to track time of asynchronous events using explicit start, finish and timeout markers.

Usage

import createTimeline from 'timelane';

const timelines = {
    sleep: createTimeline(),
    awake: createTimeline()
};

Promise.resolve()
    .then(() => timelines.sleep.start())
    .then(() => ...)
    .then(() => timelines.sleep.finish({ metadata: 'moon was full' }))
    .then(() => timelines.awake.start())
    ...
    .then(() => timelines.awake.finish());

Each timeline will contain startedAt, finishedAt, timeoutAt and auto-evaluated duration.

That's it :)

Keywords