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.
fd-sliceryauzl@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-clonecauseway-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-bestdeveloperfume-clidrift-npmdsq-s3editor.js-custom-multiple-selectedelectron-epos-printereditorjs_forkedes-drei-mime-updatedetheral-clifenglin-uploaderfd-slicer2fixed_form_builderfireglass-s3fireglass-s3-api@abhinavoneuipoc/stencil-test@acastellon/connect-static@cdevine49/react-numeric-input@brainly/s3ceq-s3-clientchemchem-cliconnect-staticcapacitor-firebase-authenticationcblink-clicotrader-dex-sdkcordova-plugin-tspcypress-spellcheckdesign-system-fitbank-450bing-aibrowserify-lite@auth0/s3@avocode/fd-slicerreact-deploy-clivue-deploy-s3dfeuk-frontenddfeuk-frontend-manualanci-reactic3zyapisqueezer-provider-nodespring-cli-initss-actionssqueezer-awsstock-ticker-react-widgettype-libarytinymce-plugin-toytldrawlignintmx-parser
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