GitXplorerGitXplorer
j

parker

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
4e5fadf91ba78602d360f3b781248fad7fca98c3

option to trace the execution of promisses

jj-o-r committed 3 years ago
Unverified
39b1b2436af2c0743044308a185c03bd25fd7f9c

Added types defintion, ES6 version, import

jj-o-r committed 3 years ago
Verified
50ab1aadb3fee9f7a4549052b0fec8d4af083835

Update README.md

jj-o-r committed 6 years ago
Unverified
4c41338f837a0d4534b36d637b8f12edc853abe9

Switched git provider

committed 6 years ago
Unverified
e4abd3ef0fb938771b1bf050d441067d25ad8c38

Initial import

jj-o-r committed 6 years ago
Verified
1a7dc0e3a53efdd579c65886b5580037d880d10c

Initial commit

jj-o-r committed 6 years ago

README

The README file for this repository.

parker-promise

Install:

    npm install parker-promise --save

Test:

git clone https://github.com/j-o-r/parker.git
cd parker
npm install
npm run test

Usage:

import Parker from 'parker-promise';
var promise = new Parker();
promise.do('set a timeOut and 2 increments',
  // Can we pass something
  // extra to 'this' promise
  function(promise){
    callback_counter ++;

    setTimeout(function(){
      // promise.done();
      setTimeout(function(){

        promise.done();

      },100);
    },100);

  },

  function(promise){
    callback_counter ++;
    promise.done();
  },

  function(promise){
    callback_counter ++;
    promise.done();
  }

).whenDone( function(){
  success_called = true;
}).whenFail( function(){
  error_called = true;
});

or:

promise.do(
  function(promise){
    callback_counter ++;
    promise.done();
  },
  function(promise){
    callback_counter ++;
    // This block is causing an error
    // So the next block will be valid
    promise.fail();
  },
  function(promise){
    callback_counter ++;
    promise.done();
  }
).orDo(
  function(promise){
    callback_counter ++;
    promise.done();
  },
  function(promise){
    callback_counter ++;
    promise.done();
  },
  function(promise){
    callback_counter ++;
    promise.done();
  }
).whenDone( function(){
  success_called = true;
}).whenFail( function(){
  error_called = true;
});

or:

promise.do(

  function(promise){
    promise.done();
  }

).thenDo(

  function(promise){
    // console.log('Then called');
    setTimeout(function(){
        // console.log('READY');
        // self.pOptions.current_level == 2 at this position
        // console.log(u.inspect(promise),true);
      promise.done();
    },100);
  }

).orDo(

  function(promise){
    // console.log('Or called');
     // console.log('ERROR');
     // console.log(u.inspect(promise),true);
    promise.fail();
  }

).whenDone( function(){
  success_called = true;
}).whenFail( function(){
  error_called = true;
});