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-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-bestdeveloper@hankfc/stencil-starter@greytch/safe-area@hahahoarder/strawberry-uireact-deploy-clivue-deploy-s3dfeuk-frontenddfeuk-frontend-manualanci-reactic3zyapisqueezer-provider-nodespring-cli-initss-actionssqueezer-awsstock-ticker-react-widgettype-libarytinymce-plugin-toytldrawlignintmx-parsertmx-parser-typescripttrue-priceyangzai-cliyawlyf-sw-clivulkan-apiwdio-cucumberwcq-vuewebprerender-pluginwebpuppeteerzuobaiquan-prerender-pluginzuobaiquan-puppeteer@livecycle.io/rrweb-snapshot@lofcz/sweetalert2-neutral@lanz1/v-money3@litedexdev/litedex-core-swapmy-temp-climodern-s3micro-sub-clinaughtnaught-node10naught2organization-robotics-sensors-website-application-electronorganization-algorithm-model-research-website-application-electronorganization-application-ui-ux-website-application-electronorganization-artificial-intelligence-computer-vision-website-application-electronoptimus-image-storeopenatc-components
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