Deft JS Promise and multiples Ajax.Request

25 views
Skip to first unread message

Jean-Marc Choulet

unread,
Nov 13, 2017, 3:01:24 PM11/13/17
to Deft JS
Hello,

We have a table of values. We must make a request for each value of the array. 

How to wrap a Ajax.Request request loop in a Promise ?

Thank,

Jean-Marc


Chad Glendenin

unread,
Nov 13, 2017, 3:30:27 PM11/13/17
to def...@googlegroups.com
You probably need to collect an array of promises, one for each request you fire, and then do something like this:

newPromise = Deft.promise.Promise.all(arrayOfPromises);

I don't know the exact syntax in Deft, because I haven't used it in a couple years, but that's the usual pattern in common promise libraries.


--
Deft JS home page: http://deftjs.org/
Wiki: https://github.com/deftjs/DeftJS/wiki
For rules and tips on asking questions on the Deft JS mailing list: https://github.com/deftjs/DeftJS/wiki/Asking-Questions-on-the-Mailing-List
---
You received this message because you are subscribed to the Google Groups "Deft JS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deftjs+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/deftjs/2153b273-8e02-4baf-985b-a7d5edf7445b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christian Fecteau

unread,
Nov 13, 2017, 3:35:35 PM11/13/17
to def...@googlegroups.com
Look up Deft.promise.Chain also. You would either use the sequence or parallel methods with an array of functions that return promises. One for each of your values.

Reply all
Reply to author
Forward
0 new messages