Prevents multiple simultaneous GET requests to same HTTP endpoint.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib 1.0.0 rewrite, babel + webpack + friends Sep 6, 2016
spec 1.0.0 rewrite, babel + webpack + friends Sep 6, 2016
src 1.0.0 rewrite, babel + webpack + friends Sep 6, 2016
.babelrc
.editorconfig
.eslintignore 1.0.0 rewrite, babel + webpack + friends Sep 6, 2016
.eslintrc.js
.gitignore
.jscsrc
README.md
package.json
webpack.config.js

README.md

mayjax

Originally named "TrafficCop", this library allows you to prevent simultaneous duplicate HTTP GET requests. The first request is allowed through, and while it's executing, any subsequents GETs with the exact same settings will be queued to have their callbacks invoked when the original call returns.

This library exports a factory that expects an instance of jQuery. The factory returns jQuery, with a mayjax method added to it:

var $ = require( "mayjax" )( require( "jquery" ) );

$.mayjax( {
    url: "/two/overlapping/request/1",
    method: "GET"
} );
$.mayjax( {
    url: "/two/overlapping/request/1",
    method: "GET"
} );
$.mayjax( {
    url: "/two/overlapping/request/1",
    method: "GET"
} );

Building, Tests, etc.

To build: npm run build. This will create a UMD-wrapped module (via webpack) in the lib directory.

To run tests: npm test

To do other things: npm run to see the list.