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

quenda

v1.0.8

Published

A simple javascript function queue.

Downloads

4

Readme

Quenda

Build Status Codacy Badge

Quenda is a simple javascript function queue. With quenda you can create queues of functions and execute them in order with a delay. It also has controls for executing next and previous functions, playing and pausing the queue and many more...

  • IE9+
  • No jQuery needed.
  • Just one dependency: merge
  • AMD and CommonJS compatible.
  • Works both node and browser environments.

Install

npm install quenda

bower install quenda

Using in a CommonJS environment (node, webpack, ...)

var Quenda = require('quenda');
var myQueue = Quenda.new();
//..

Using in a AMD environment (requirejs, webpack,...)

require(['quenda'], function(Quenda) {
  var myQueue = Quenda.new();
  //..
});

Using without any module loader

<script type="text/javascript" src="path/to/your/merge/download/folder/merge.js">
<script type="text/javascript" src="path/to/your/quenda/download/folder/dist/quenda.min.js">

<script type="text/javascript">
    var myQueue = Quenda.new();
    //...
</script>

Simple example

You can easily create new queues like this:

require(['quenda'], function(Quenda) {

  var myQueue = Quenda.new().add([
    {
        nextDelay: 2000,
        fn: function() {
            console.log('first');
        }
    },
    {
        fn: function() {
            console.log('second');
        }
    }
  ]);

  myQueue.play();

  console.log(Quenda.getAll()); //Prints an array with all the queues (1 queue in this case)
});

After executing this code you will se in your console log output the word 'first' and after 2 seconds the word 'second'.

Advanced example

Check demo/index.html for a more complex example.

Main object (Quenda) API

Quenda is the main object that creates and stores queues.

Method | Description | ---------|---------------| new(config) | Creates new queues (see below for config options) getAll() | Get an array with all queues delete(index) | Delete a queue by index deleteAll() | Deletes all queues

New queue config options

Variable | Default Value | Description | Type ---------|---------------|-------------|-------------- loop| false | Defines if the queue should loop. | boolean maxLoops | Infinity | Defines the max number of loops. | number (integer) defaultDelay | undefined | Define the default delay for the queue steps with no delay defined. | number (ms)

Queues API

The new queues created with Quenda.new() have this API:

Method | Description | ---------|---------------| add(stepConfig) | Adds a step to the queue (see below for config options) play() | Plays the queue pause() | Pauses the queue next() | Executes the next step in the queue. Loops if the queue is configured to loop. prev() | Executes the previous step in the queue. Does not loop, stops when the queue reaches the first element.

New step config options

You can create new steps using Quenda.new(stepConfig) and also Quenda.new([stepConfig, stepConfig, ...]). See basic example above.

Variable | Description | Type ---------|-------------|-------------- nextDelay| The number of miliseconds to wait before executing the next step. If it is not present the queue will stop unless it is configured with a defaultDelay value (see avobe). | number (ms) fn | Function to execute in this step. The this value is binded to the queue itself and the first argument is the current step. See demo/index.html for an example. | function autoDestroy | If true the step will be executed once and then removed from the queue. | boolean preload | An array of image urls that will be preloaded before this step is executed. The time will start to count after the preload is completed. Note: this only works in browser environments. | array

Building

  1. npm install
  2. gulp build

Changelog

  • 1.0.5: bower and npm
  • 1.0.4: first public version
  • 1.0.3: Bug fixes. Implemented autoDestroy.
  • 1.0.2: Travis integration
  • 1.0.1: Bug fixes
  • 1.0.0: Initial version.

License

MIT.

Created by Berto Yáñez @bertez