Code Monkey home page Code Monkey logo

chronojs's Introduction

ChronoJS

Javascript - Backbone - Timer

This is a Backbone model for manage timers with a periodic ticks.

The main features are its ability for pause the timer in middle of a period, and resume the paused period and the subsecuent ticks.

Methods:

initialize: function (period, callback, options)

returns: this

period is the tick's period

callback is for call at the end of each period. Now a boolean param lastBeat is passed in the last one!!

options is an optional object with this properties:

  • ticks: how much periods do you want. (default is 1, and if you pass 0 it means infinity)

start: function ( )

starts the timer.

stop: function ()

stops the timer.

pause: function ()

pause the timer

resume: function () resume the timer the resume methods firt do de partially done period, and then continue with the whole remaining periods. // deprecated: "and allow to pass optional new period and callback params"

getRemainingTicks: function ()

returns the remaining whole ticks.

getRemainingTickTime: function ()

returns the current period remaining time.

getRemainingTime: function ()

returns the timer remaining time, that is the current period remaining more the remaining ticks times.

getState: function () returns the state string: stopped, started or paused. Is a result of a better chrono state manage.

getTicks: function () returns the ticks ( not the remaining else the used for start the timer)

setTicks: function ( ticks ) return: this ( not the remaining else the used for start the timer )

getPeriod: function () returns the period

setPeriod: function () //for use in stopped state, I fix this soon.... returns this

addRemainingTicks: function ()

If not in stopped state, adds remaining ticks.

return this

chronojs's People

Contributors

pelicanorojo avatar

Watchers

 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.