Giter Site home page Giter Site logo

jslss's Introduction

jslss

useful browser javascript modules from laughing sun studio (formerly seacgroup)

jslss includes the following modules: Timer - a pausable seconds (accurate to milliseconds) timer with listener support and state restore

Class Timer (libs/lss/Timer.js)

Creates an instance of Timer.

constructor Timer( options ) @param options object options configuration options for the timer. configuration options: started the started time (system time) stopped the stopped time (system time) elapsed the number of seconds elased since the timer started paused true is the timer should start paused timeout the number of seconds used to calculate remaining property

property state - readonly @returns object returns this Timer's current state (can be used to restore the timer across page loads)

property started - readonly number the date time when the Timer was started

property stopped - readonly number the date time when the Timer was stopped

property timeout number the seconds used to calculate remaining seconds until timeout

property paused boolean the state of whether the Timer is paused

property elapsed number the number of seconds elapsed since the Timer was started

property remaining number the number of seconds remaining until Timer timeout

method restore( options ) param options object options state options for restoring the timer. returns {this} returns this Timer

method addEventListener( eventType, callback, data ) param eventType string support event types are "timeout" and "interval". "timeout" event triggers when (data as seconds) or remainder (if data is null) expires (reaches zero) "interval" event triggers every (data as seconds) param callback Function the event callback function. param data mixed event type dependant (may be optional) returns {this} returns this Timer

method removeEventListener( eventType, callback ) param eventType string support event types are "timeout" and "interval". param callback Function the event callback function to be removed (or "*" for all)

method toString( format ) param format string the format for the elapsed (or remaining if timeout is set) seconds (optional) returns {this} string string representation of elapsed (or remaining if elapsed is defined) if no format is specified the string will be simple number as string format

method toLocaleString( format ) returns {this} string string representation of elapsed (or remaining if elapsed is defined) if no format is specified the string will be simple number as string format

method valueOf( ) returns {this} number representation of elapsed (or remaining if elapsed is defined)

jslss's People

Contributors

seacgroup avatar

Stargazers

 avatar

Watchers

James Cloos 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.