GithubHelp home page GithubHelp logo

crisbal / tictoc.js Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 7 KB

Simple JavaScript module to schedule events via a timer, with the ability to start and stop the timer.

JavaScript 100.00%
timer javascript node scheduled-events stopwatch countdown

tictoc.js's Introduction

TicToc.js

Simple JavaScript module to schedule events via a timer, with the ability to start and stop the timer. It works both in the browser and in Node.js.

Sample Usage

timer = new TicToc.TicToc();
timer.after(0, function() {
	console.log("This is executed on timer start");
});
timer.after(1500, function() {
	console.log("This is executed after 1.5 seconds");
	   
    timer.afterFromNow(500, function() {
        console.log("This is executed after 500ms of the current time: 2 seconds.");
        timer.stop(); // stops the timer
    });
});
timer.after(3000, function() {
	console.log("This is never executed because the timer stopped. Use timer.start() to resume execution.");
});
timer.start(); // starts the time

Installation

Browser

For development:

<script src="https://rawgit.com/crisbal/TicToc.js/master/TicToc.js"></script>

For production:

  • git clone https://github.com/crisbal/TicToc.js
  • <script src="TicToc.js/TicToc.js"></script>

Node.js

TODO

Examples

Check out the examples folder.

Documentation

Check out the documentation to see the available methods of the TicToc class.

If you are curious on how the library works just open TicToc.js and read all the comments.

Contributing

Feel free to open issues and submit pull requests!

License

GPL 3.0

tictoc.js's People

Contributors

crisbal avatar

Stargazers

Giulio Muscarello avatar Denys Vitali avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.