Code Monkey home page Code Monkey logo

bus's Introduction

#Bus

A simple javascript library to perform timer operations. It is useful to perform operations repeatedly or at a perticular time.

##Setup Include the bus.js to your page

<script type="text/javascript" src="bus.js"></script>

##Initialization After including the library, start the bus to run it.

<script>
Bus.start();
</script>

##Load Handlers After starting the bus we need to load the handlers to get triggered at perticular time

Bus.every(Bus.time.sec,function(){
  console.log(Bus.time.to('sec'); //will get triggered at every second and show the seconds.
});

#Customize You can customize the Bus frequencey ie times per second.

Bus.start(10); //Bus trigs 10 times a second

#Options List of handler options are given below

Bus.every(time, function(){}); //will get triggered each time
Bus.at(time, function()); //will get triggered at the time
Bus.from(time, function()); //will get triggered from the time
Bus.till(time, function()); //well get triggered till the time
Bus.between(from_time, to_time, function(){}); //will get triggered in between the times

List of times

Bus.time.mil //milli second
Bus.time.sec //second
Bus.time.min //minute

List of time checkers

if(Bus.time.isSec()){} //true for every sec
if(Bus.time.isSec(10)){} //true for every 10th sec
if(Bus.time.isMin()){} //true for every min
if(Bus.time.isMin(10)){} //true for every 10th min
if(Bus.time.isSecOnce(10)){} //true for first 10th sec
if(Bus.time.isMinOnce(10)){} //true for first 10 min

Pause the bus

Bus.pause();

bus's People

Contributors

pskd73 avatar

Stargazers

 avatar

Watchers

 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.