npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gm-tick

v1.0.2

Published

Single, managed animation frame loop for games, animations and audio functions.

Downloads

2

Readme

Tick

A single animationFrame/timeout loop with normalised output across browsers. Callbacks are passed as parameters the time elapsed since the callback was added and a function to stop the callback from being called again.

Uses requestAnimationFrame and microsecond timings if the browser supports it.

Supports global pause and resume, and pause and resume on the level of individual tasks.

This module has been used extensively in co-ordination animations, supporting game loops and web audio stuff. It is solid.

Installation

Browserify/NPM

    $ npm install --save gm-tick
  var tick = require('gm-tick');

Component

    $ component install charlottegore/tick
  var tick = require('tick');

API

.add()

Adds a callback to the loop to be called every tick. When the callback fires is is passed the time in milliseconds (and, if available, microseconds) since the callback was added. Returns a handle object.

Example

var handle = tick.add( function( elapsed, stop ){

	console.log( elapsed )
	if( elapsed > 5000){
       stop(); // make sure the callback won't fire again 
       console.log('stopped');   		
	}

});

> 1.12244043334424
> 4.32443350003422
...
> 4994.00000000598
> 5011.00000000422
> stopped

.pause()

require('tick').pause();

Pause everything. No callbacks will fire as long as it remains paused.

.resume()

require('tick').resume();

Resume everything. Elapsed time data passed to callbacks are adjusted to account for time spent paused.

.time()

Returns a normalised (relative to the timings passed to callbacks) 'time' according to Tick, which may vary depending on whether it's using performance or Date for timings. time() returns the time elapsed since the page loaded.

Handle API

When a callback is added to Tick, a handle object is returned. This is their API.

.stop()

Stop the callback from ever being fired again.

> var handle = require('tick').add(callback);
> // callback is being called on every tick
> handle.stop();
> // callback has been removed

.pause()

Prevent this callback from being called until resumed.

> var handle = require('tick').add(callback);
> // callback is being called on every tick
> handle.pause();
> // callback has been paused

.resume()

Let a callback be called after being paused.

> handle.pause();
> // callback won't fire until resumed
> handle.resume();
> // callback fires again.

License

MIT