• Login
    • Report A Bug
    • System Information
    • System Tests
    • System Policies
    • Code Documentation
    • Occam Source Code
    • Web Client Source Code
    • About Occam
    • Acknowledgements
    • Guides / Documentation
    • Publications

translation missing: en.flash.saving
translation missing: en.flash.error
  • Bibliography Data
  • Metadata
resource
  • git
    https://github.com/andrewrk/node-pend.git Source Repository
    QmYqjQQysTMm52nNbSFhQkvrBfZ1CbveW8Va2uAAxvPWqX
    ed57bbe8520518dca24d0c6bb847ffb6b68ae6f9
      QmYqjQQysTMm52nNbSFhQkvrBfZ1CbveW8Va2uAAxvPWqX
      ed57bbe8520518dca24d0c6bb847ffb6b68ae6f9

      • Details
      • Files
      • History
        • Source

          https://github.com/andrewrk/node-pend.git

          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.
          

          Related

          • maintainer

            npm

          Share

          • URL

            Copy
          • Embed Link

            Copy
          • QR Code

        • JavaScript must be enabled.

          There was an error retrieving this content.

          The content could not be found.

        • JavaScript must be enabled.

          There was an error retrieving this content.

          The content could not be found.

        Confirm
        Do you wish to proceed?

        Confirm message?