1.0.1 • Published 8 years ago

promise-inflight v1.0.1

Weekly downloads
11,103,297
License
ISC
Repository
github
Last release
8 years ago

promise-inflight

One promise for multiple requests in flight to avoid async duplication

USAGE

const inflight = require('promise-inflight')

// some request that does some stuff
function req(key) {
  // key is any random string.  like a url or filename or whatever.
  return inflight(key, () => {
    // this is where you'd fetch the url or whatever
    return Promise.delay(100)
  })
}

// only assigns a single setTimeout
// when it dings, all thens get called with the same result.  (There's only
// one underlying promise.)
req('foo').then(…)
req('foo').then(…)
req('foo').then(…)
req('foo').then(…)

SEE ALSO

  • inflight - For the callback based function on which this is based.

STILL NEEDS

Tests!

vuedragdropuploadimagespopsmart-common-authkilli8n-react-native-fast-image@cashremit/cr-streamline-iconsbb-chat@frxf/frxf@texttree/demo-bsa-reference-rcl@fundefund/funde_ckgql_din_mod@l1nyanm1ng/react-picture-viewer@saeon/ol-react@saeon/quick-formcogoportutilsjs4cytoscape@mink-opn/build-tokens@infinitebrahmanuniverse/nolb-promise-@saaspe/componentsexpand-react-bridgenode-gio@everything-registry/sub-chunk-2481test-carosello-campustest-iki-mini-appwinx-form-winxweb-elements-iconsvue-button-test1webchewow.js-juziwuchuansupercluster-googlemaps-adapter-clonestestapatestujsk_custom_ckeditor5svelte-component-libtextfield-samplevue-compmentvue-dev-clone@drblmthw/testujsk_custom_ckeditor5@ct-note/table@ct-note/warning@ct-note/image@ct-note/inline-code@ct-note/list@ct-note/marker@ct-note/paragraph@ct-note/quote@ct-note/simple-image@ct-note/checklist@ct-note/code@ct-note/delimiter@ct-note/embed@ct-note/header@cube-design/react@cybermega/flutter-resource-manager-rs@blkmarketco/components-library@beldore/react-otp-input@percent/percent-api-hooks@positionex/position-sdk@rbc-public/react-selectable-fastjeuxuijesusdemojamuskalimjameslinenode.js1@simstudio/htmldiffdfeuk-frontenddfeuk-frontend-manualsushi-sdk-ftm@castrum-nubis/bulmazzzxxxyyy321123styletoolsstnenopmoc-iustock-ticker-react-widgettehmusimhujanud7-act2tingzi-vuepresstinymce-plugin-toyu-librarytldrawlignin@artiso-solutions/vue-html-to-paper@applaud/cacache@asiz33/smartblok-vendure-plugin@arielapaula/components@arielapaula/test@beisen/npm@buganto/client@carhoo/widget-dealers@cdk8s-extensions/argo-rollout@cleveradssolutions/cas.cordova.ironsource@cleveradssolutions/cas.cordova.kidoz@cleveradssolutions/cas.cordova.mintegral@cleveradssolutions/cas.cordova.mytarget@cleveradssolutions/cas.cordova.optimal@cleveradssolutions/cas.cordova.pangle@cleveradssolutions/cas.cordova.superawesome@cleveradssolutions/cas.cordova.tapjoy@cleveradssolutions/cas.cordova.unity@cleveradssolutions/cas.cordova.vungle@cleveradssolutions/cas.cordova.yandex@cleveradssolutions/cas.cordova.adcolony@cleveradssolutions/cas.cordova.admob@cleveradssolutions/cas.cordova.applovin@cleveradssolutions/cas.cordova.facebook
1.0.1

8 years ago

1.0.0

8 years ago