1.2.2 • Published 5 years ago

timer-tracks v1.2.2

Weekly downloads
10
License
MIT
Repository
github
Last release
5 years ago

timer-tracks

CircleCI Status Codecov npm npm npm semantic-release

Timeline's controller with label to navigate

Install

npm i timer-tracks
or
yarn add timer-tracks


Importing

import TimerTracks from "timer-tracks";

Quick start

Usage timer-tracks plugin.

const tracks = [
    { name: "intro", duration: 5 },
    { name: "start", duration: 10 },
    { name: "end", duration: 5 },
    { name: "outro", duration: 20 }
];

const timerTracks = TimerTracks(tracks);

timerTracks.update(0);
timerTracks.current.name; //? intro
timerTracks.current.progress; //? 0

timerTracks.update(10);
timerTracks.current.name; //? start
timerTracks.current.progress; //? .5

Methods

.update(num)

Set progress current track and update current attribute.

argumenttypeDescription
numnumbercurrent progresse
timerTracks.update(0);
timerTracks.update(10);

timerTracks.current.name; //? start
timerTracks.current.progress; //? .5

.goTo(name)

Set current track with name. And launch update() to apply

argumenttypeDescription
namestringname's target on tracks
timerTracks.goto("end");
timerTracks.update(10);

timerTracks.current.name; //? end
timerTracks.current.progress; //? 0

.next()

Set current track with the next. And launch update() to apply

the limit is null

timerTracks.next();
timerTracks.update(0);

.prev()

Set current track with the prev. And launch update() to apply

the limit is the first tracks

timerTracks.prev();
timerTracks.update(0);
1.2.2

5 years ago

1.2.0

5 years ago

1.2.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago