New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jquery-deferred-sequence

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-deferred-sequence

Sequentially process a value through a list of jQuery Deferred objects.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

jQuery Deferred Sequence

Allows a value to be sequentially processed through a list of objects, usually Deferred objects that represent asynchronous events.

var value = 0,
    items = [
        function( value ) {
            return value + 1;
        },
        function( value ) {
            var dfd = $.Deferred();

            setTimeout(function() {
                dfd.resolve( value * 2 );
            }, 1000 );

            return dfd;
        },
        function( value ) {
            return value * value;
        }
    ],
    sequence = $.Deferred.Sequence( items );

sequence.reduce( value, function( func, value ) {
    return $.when( func( value ) );

}).done(function( value ) {
    console.log( value ); // => 4
});

Methods

  • reduce( [ intialValue, ] callbackFunction [, context ] ) Promise
    Apply a function against each item in the sequence, optionally calling the function with the specified context.

Properties

  • head Deferred
    A deferred object representing the beginning of the sequence.

  • items Array, Object
    The items given to the sequence on initialization.

  • master Deferred
    A deferred object which tracks the aggregate state of all the deferreds in the sequence.

  • tail Deferred
    A deferred object representing the end of the sequence.

License

Copyright (c) 2013 Kyle Florence
Dual licensed under the MIT and GPLv2 licenses.

Keywords

FAQs

Package last updated on 31 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc