Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dotdev/ajax-queue

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotdev/ajax-queue

Front end ajax queue and request handler

  • 0.0.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
3
Weekly downloads
 
Created
Source

Q - Ajax queue

Usage

const queue = new Q([config]);
queue.add([request]);

config - object

The config object is not required

NameDescriptionTypeDefault
successThe callback for all successful ajax requests processed by this queuefunctionDispatch a Q:requestCompleted event
errorThe callback for all unsuccessful ajax requests processed by this queuefunctionDispatch a Q:requestFailed event
completedAllRequestsEventThe event type that will be dispatched once all requests have finishedstringQ:requestsCompleted
completedRequestEventThe event type that will be dispatched after each request is finishedstringQ:requestCompleted
failedRequestEventThe event type that will be dispatched after a request has failedstringQ:requestFailed
requestStartedEventThe event type that will be dispatched after each request has startedstringQ:requestStarted
errorEventThe event type that will be dispatched after Q has thrown an errorstringQ:error

Methods

add

Description

Adds a request to the currently running queue, this will cause the queue to process each item, one at a time until all requests have been resolved.

Example
  const queue = new Q()

  // Build the ajax request
  const request = {
    url: '/cart/add.js',
    data: item,
    success: options.success,
    error: options.error
  }

  // Add the request to the ajax request queue
  this.queue.add(request)
  })
request - object
NameDescriptionRequiredTypeDefault
successThe callback for a successful response, overwrites the queue default.falsefunctionDispatch a Q:requestCompleted event
errorThe callback for an unsuccessful response, overwrites the queue default.falsefunctionDispatch a Q:requestFailed event
urlThe url that the request will be sent totruestringnull
methodThe method that will be used to make the requestfalsestringGET
dataAny data that you wish to send to the requestfalseanynull
dataType*The type of data that we expect to recieve from the requestfalsestring''
dataType

Read more here

Options: '', 'arraybuffer', 'blob', 'document', 'json', 'text'

Keywords

FAQs

Package last updated on 18 Dec 2018

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