Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion : Deferred - Maintainable asynchronous JavaScript with promises

Received: by 10.58.35.204 with SMTP id k12mr5336692vej.20.1349195436920;
        Tue, 02 Oct 2012 09:30:36 -0700 (PDT)
X-BeenThere: nodejs@googlegroups.com
Received: by 10.52.175.170 with SMTP id cb10ls508924vdc.1.gmail; Tue, 02 Oct
 2012 09:30:27 -0700 (PDT)
Received: by 10.52.37.12 with SMTP id u12mr2680870vdj.8.1349195427955;
        Tue, 02 Oct 2012 09:30:27 -0700 (PDT)
Date: Tue, 2 Oct 2012 09:30:27 -0700 (PDT)
From: Mariusz Nowak <mari...@medikoo.com>
To: nodejs@googlegroups.com
Message-Id: <75c92f7a-c815-4c05-819e-d61f1747c988@googlegroups.com>
In-Reply-To: <53d7f78c-9269-4cc7-b0b5-7ea4cb7d0006@googlegroups.com>
References: <3f9821de-ca3a-4930-8c3e-41824d9615d0@googlegroups.com>
 <c7b69b98-8a8f-47e1-a0bc-5b28dd6d5ad9@googlegroups.com>
 <e8bb42a2-166c-4b2e-92cd-e659170eb099@googlegroups.com>
 <53d7f78c-9269-4cc7-b0b5-7ea4cb7d0006@googlegroups.com>
Subject: Re: [ANN]: Deferred - Maintainable asynchronous JavaScript with
 promises
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_492_11956802.1349195427576"

------=_Part_492_11956802.1349195427576
Content-Type: multipart/alternative; 
	boundary="----=_Part_493_491715.1349195427576"

------=_Part_493_491715.1349195427576
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Jeff, I think you're talking about different implementation: 
https://npmjs.org/package/Deferred it's still at v0.1.1 and in fact it 
resembles jQuery's Deferred. It was published later on npm with same name 
but uppercased (Today npm wouldn't allow that ;)

For Deferred (one that opened this topic) changes are carefully described 
in https://github.com/medikoo/deferred/blob/master/CHANGES v0.1 -> v0.6 
might be a long read ;)

Answering your questions:

On Tuesday, October 2, 2012 6:01:03 PM UTC+2, Jeff Barczewski wrote:
>
>
>  - .promise() becomes .promise
>
 

Exactly .promise returns something conceptually same as .promise() in 
jQuery's version

>  - Deferred.when()  - I will have to create my own, right?

There's no when in this Deferred implementation. Same can be achieved with:

deferred(promiseOrValue).then(onsuccess, onerror);

 

> Anything else that you remember which will need to change? (I know this 
> was a long time ago when you changed it so not a big deal if you don't 
> remember)
>
>
'fail', 'always' and 'done' can be achieved with 
promise.aside: https://github.com/medikoo/deferred#aside

In general Deferred (v0.6) implementation provides solutions to many other 
use cases, so it has much more to offer. jQuery's implementation is very 
basic, it evolved on client-side where asynchronous programming is not as 
complex as in Node.js

Cheers!
Mariusz

------=_Part_493_491715.1349195427576
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Jeff, I think you're talking about different implementation: https://npmjs.=
org/package/Deferred it's still at v0.1.1 and&nbsp;in fact it resembles jQu=
ery's Deferred.&nbsp;It was published later on npm with same name but upper=
cased (Today npm wouldn't allow that ;)<div><br></div><div>For Deferred (on=
e that opened this topic) changes are carefully described in&nbsp;https://g=
ithub.com/medikoo/deferred/blob/master/CHANGES v0.1 -&gt; v0.6 might be a l=
ong read ;)</div><div><br></div><div>Answering your questions:<br><div><br>=
</div>On Tuesday, October 2, 2012 6:01:03 PM UTC+2, Jeff Barczewski wrote:<=
blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bord=
er-left: 1px #ccc solid;padding-left: 1ex;"><div><br></div><div>&nbsp;- .pr=
omise() becomes .promise</div><div></div></blockquote><div>&nbsp;</div><div=
><br></div><div>Exactly .promise returns something conceptually same as .pr=
omise() in jQuery's version</div><div><br></div><div>&gt; &nbsp;- Deferred.=
when() &nbsp;- I will have to create my own, right?<br></div><div><br></div=
><div>There's no when in this Deferred implementation. Same can be achieved=
 with:</div><div><br></div><div>deferred(promiseOrValue).then(onsuccess, on=
error);<br></div><div><br></div><div>&nbsp;</div><blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;"><div>Anything else that you remember which will need to =
change? (I know this was a long time ago when you changed it so not a big d=
eal if you don't remember)</div><div><br></div></blockquote><div><br></div>=
<div>'fail', 'always' and 'done' can be achieved with promise.aside:&nbsp;h=
ttps://github.com/medikoo/deferred#aside</div><div><br></div><div>In genera=
l Deferred (v0.6) implementation provides solutions to many other use cases=
, so it has much more to offer. jQuery's implementation is very basic, it e=
volved on client-side where asynchronous programming is not as complex as i=
n Node.js</div></div><div><br></div><div>Cheers!</div><div>Mariusz</div>
------=_Part_493_491715.1349195427576--

------=_Part_492_11956802.1349195427576--