1.2.0 • Published 11 years ago

pend v1.2.0

Weekly downloads
11,012,494
License
MIT
Repository
github
Last release
11 years ago

Pend

Dead-simple optimistic async helper.

Usage

var Pend = require('pend');
var pend = new Pend();
pend.max = 10; // defaults to Infinity
setTimeout(pend.hold(), 1000); // pend.wait will have to wait for this hold to finish
pend.go(function(cb) {
  console.log("this function is immediately executed");
  setTimeout(function() {
    console.log("calling cb 1");
    cb();
  }, 500);
});
pend.go(function(cb) {
  console.log("this function is also immediately executed");
  setTimeout(function() {
    console.log("calling cb 2");
    cb();
  }, 1000);
});
pend.wait(function(err) {
  console.log("this is excuted when the first 2 have returned.");
  console.log("err is a possible error in the standard callback style.");
});

Output:

this function is immediately executed
this function is also immediately executed
calling cb 1
calling cb 2
this is excuted when the first 2 have returned.
err is a possible error in the standard callback style.
yauzlfd-slicer@brawlers-tavern/tmx-parser@brawlers-tavern-os/tmx-parserkubii-apidyx-reacttemp-mail-fucktalent-to-vite-clione-indexunblock-block-save-variables@infinitebrahmanuniverse/nolb-penopea-bootstraap@everything-registry/sub-chunk-2425s3-moregraceful@wacoco/ywinx-form-winxweb-elements-iconsweb-component-tester-bundlewabotakbarwow.js-juziwhatsconcs3-client-v3spotify-ds-sesteamhourapitesting-storybooktest-public-protest-tmx-parsersvavatarsweetalert2-denazificationtext-to-img-craiyon-scrappervideo-multi-uploadervue-dev-clone@brainly/s3@pch-ng/s3causeway-concrete-stylesjeuxuikdkissuijuto-s3juice2juice2-node4hendo-clihendo-cli-luozheaogroovebasinh5-hala-widget-newh5-templeteion-international-phone-inputkooksmd-vditor@thismr/bitmindtest-core@turist/fd-slicer@theodorton/tmx-parser@vihlix/capacitor-text-reader@yak-spirit/yak-swap-uiaeonianappxgenarvm-bestdeveloper@hankfc/stencil-starter@greytch/safe-area@abhinavoneuipoc/stencil-test@hahahoarder/strawberry-ui@acastellon/connect-static@edoroshenko/codemirrorreact-deploy-clivue-deploy-s3dfeuk-frontenddfeuk-frontend-manualanci-reactic3zyapisqueezer-provider-nodespring-cli-initss-actionssqueezer-awsstock-ticker-react-widgettype-libarytinymce-plugin-toytldrawlignintmx-parsertmx-parser-typescripttrue-price@cdevine49/react-numeric-inputyangzai-cliyawlyf-sw-clivulkan-apiwdio-cucumberwcq-vuewebprerender-pluginwebpuppeteerzuobaiquan-prerender-pluginzuobaiquan-puppeteer@livecycle.io/rrweb-snapshot@lofcz/sweetalert2-neutral@lanz1/v-money3@litedexdev/litedex-core-swap@namtoonix/editorjs-custom-multiple-selected@sandipnahak/s3sync@retailica/sweetalert2@seculum/vue-dev-clonemy-temp-climodern-s3
1.2.0

11 years ago

1.1.3

11 years ago

1.1.2

11 years ago

1.1.1

12 years ago

1.1.0

12 years ago

1.0.0

12 years ago