You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • To get a better understanding, I tried to get promise-simple in jsfiddle.
    My idea was to use something like this.

        console.log(new Date());
        function t(d) {
            var pd = Promise.defer();
            setTimeout(function() {pd.resolve("first" + d);}, d*1000);
            return pd;
        };
        Promise.when(t(1),t(2)).then(function(reĀ­sults) {console.log(new Date(),results);});
    

    In this example function in then is called after having finished t(1) and t(2).
    In log you can see delay of 2 secs for the slower function.
    To get this running, I had to remove .resolve() for isPromise-part in when function. This problem exists in all sources and examples I found in github.
    Therefore I'm unsure whether this is a correct solution. At least it does what I expect to do.

About

Avatar for JumJum @JumJum started