Skip to content

Periodic triggering of "tick" event on document for jQuery.

License

GPL-2.0, MIT licenses found

Licenses found

GPL-2.0
GPL-LICENSE.txt
MIT
MIT-LICENSE.txt
Notifications You must be signed in to change notification settings

Murphy1976/Metronome

 
 

Repository files navigation

jQuery Metronome Plugin 0.1

A metronome is any device that produces regular, metrical ticks (beats). [courtesy of wikipedia.org]

Simply put, when jQuery Metronome plugin is started it ticks (triggers tick event) on document level and keeps doing that periodically until stopped. It is an event-based wrapper of built-in setInterval (well, setTimeout to be precise) for jQuery.

Requires any version of jQuery


$.metronome.start([tempo])

$.metronome.start(); // will tick once every second (default tempo)
$.metronome.start(10); // will tick 10 times a second

Each metronome tick then triggers "tick" event bindable on document like so:

$(document).bind('tick', function(){
	... code which gets executed on each tick...
});

$.metronome.stop()

$.metronome.stop(); // will stop ticking

$.metronome.tempo

Default metronome tempo in ticks per second (Hz). Defaults to 1 Hz.

$.metronome.tempo= 10; // will set default tempo to 10 Hz

$.metronome.event

Name of the event periodically triggered on the document. Defaults to "tick".

$.metronome.event= "foo"; // will trigger "foo" event on each tick

$.metronome.ticking

Boolean value asserting that metronome is ticking.

$.metronome.ticking; // will return `true` in case of a ticking metronome

Open-source, of course!

Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. Copyright (c) 2010 Petr Vostrel

About

Periodic triggering of "tick" event on document for jQuery.

Resources

License

GPL-2.0, MIT licenses found

Licenses found

GPL-2.0
GPL-LICENSE.txt
MIT
MIT-LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 89.6%
  • CSS 7.7%
  • HTML 2.7%