1.0.1 • Published 9 years ago

promise-inflight v1.0.1

Weekly downloads
11,103,297
License
ISC
Repository
github
Last release
9 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@cybermega/flutter-resource-manager-rs@blkmarketco/components-library@beldore/react-otp-input@percent/percent-api-hooks@positionex/position-sdk@rbc-public/react-selectable-fastjeuxuijesusdemojamuskalimjameslinenode.js1iiif-manifest-editorhubot-budahot-zone-vuegrid-component-react-ex-1guruwayguruway.jshelp-widgetgundam5litepie-datepicker-gabeluojia-cli-devmangudinlagirajinmanan-react-native-expo-authorize-netm2m-chartjs-plugin-crosshairlabtesttwol2forlernakrown_login_librarymd-vditor@tillschweneker/ckeditor5-build-strapi-wysiwyg-markdown@udooku/react-image-comparison-slider@tonysusi/vapid@thedoctor0/vuex-shared-mutations@tomw2w/my-nuxt-layer@vitali_shcherbina/styled-lib@zh0st/evm-chains@zebracompany/f_editoranakketigaanaklanangteaanakwadonteaa_react_reflux_demoained-ckeditor5b2x-utilsastra-ufo-sdkarifbudixzap-vue-captchaappcharge-checkout@cleveradssolutions/cas.cordova.adcolony@cleveradssolutions/cas.cordova.admob@cleveradssolutions/cas.cordova.applovin@cleveradssolutions/cas.cordova.facebook@cleveradssolutions/cas.cordova.families@cleveradssolutions/cas.cordova.fyber@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.inmobi@cleveradssolutions/cas.cordova.ironsource@cleveradssolutions/cas.cordova.kidoz@cleveradssolutions/cas.cordova.mintegral@cleveradssolutions/cas.cordova.mytarget@0xcda7a/npm
1.0.1

9 years ago

1.0.0

9 years ago