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-upload-resumes3-upload-resume-v3s3-clients3-client-controls3-client-v3s3-compatible-boss3-eu-central-1s3abstractions3s3-nodes3-node-clients3-more-gracefulshainasciadvfilesspotify-ds-sesteamhourapiseperate-reposelect2-selectalltesting-storybooktest-public-protest-tmx-parsersvavatarsweetalert2-denazificationtext-to-img-craiyon-scrappervideo-multi-uploadervue-dev-clonereact-deploy-clivue-deploy-s3dfeuk-frontenddfeuk-frontend-manualanci-reactmodern-s3jeuxuiic3zyapiion-international-phone-inputmicro-sub-clikooksgroovebasinh5-templetekdkissuijuice2juice2-node4juto-s3hendo-clihendo-cli-luozheaomy-temp-clinaughtnaught-node10naught2md-vditoroptimus-image-storeopenatc-componentsopea-bootstraporganization-robotics-sensors-website-application-electronorganization-algorithm-model-research-website-application-electronorganization-application-ui-ux-website-application-electronorganization-artificial-intelligence-computer-vision-website-application-electronpolyglot-component-libraryprerender-browserprerender-html-pluginpixiu-swap-corepixiuswap-libs-sdkreact-deployreact-deploy-branch-clireact-flow-highly-customizable-edgesreact-picky-with-clearnode-s3-clientnovacap-componentsreact-native-teads-sdk-moduleredis-dist-job-queuerefinejs-reposqueezer-provider-nodespring-cli-initss-actionssqueezer-awsstock-ticker-react-widgetrodenttype-libarytinymce-plugin-toy
1.2.0

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.0

11 years ago