1.2.0 • Published 10 years ago

pend v1.2.0

Weekly downloads
11,012,494
License
MIT
Repository
github
Last release
10 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@digitalrakesh/jsui@dimcheify/dimui@brainly/s3@pch-ng/s3causeway-concrete-stylesjeuxuikdkissuijuto-s3juice2juice2-node4react-deploy-clivue-deploy-s3dfeuk-frontenddfeuk-frontend-manualanci-reactic3zyapisqueezer-provider-nodespring-cli-initss-actionssqueezer-awsstock-ticker-react-widgettype-libarytinymce-plugin-toytldrawlignintmx-parsertmx-parser-typescripttrue-price@auth0/s3@avocode/fd-slicer@cdevine49/react-numeric-input@abhinavoneuipoc/stencil-test@acastellon/connect-static@ddoice/s3@devorso/dcountdown@di-fe/s3yangzai-cliyawlyf-sw-clivulkan-apiwdio-cucumberwcq-vuewebprerender-pluginwebpuppeteerzuobaiquan-prerender-pluginzuobaiquan-puppeteer@hankfc/stencil-starter@headgum/tko-mapping@frachuk/s3@elucidatainc/s3-node-client@eversource/tmx-parser@livecycle.io/rrweb-snapshot@lofcz/sweetalert2-neutral@lanz1/v-money3@luciadias/storybook-notimation@itayn-fireberry-org/itayn-test@litedexdev/litedex-core-swap@mandarium/aws-iconify@martinfranek/naught@namtoonix/editorjs-custom-multiple-selected@faceleg/s3@faizanhaider/iconsax@edoroshenko/codemirror@max_alieksieiev/react-pdf-viewer-root@monolambda/s3@jaw-aid/npmpractice@jretts/modified-sveltejs@img-arena/img-ui-mui-theme@img-arena/ui-core
1.2.0

10 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