Haxe queue for running async tasks sequentially in js


(Дмитрий Маликов) #1

i have some third part rest api libary which make http requests asynchroniusly in oldscool callbacks style

RestApi.callMethod('products.list', {some_param_active: 1}, function (result) { 
  console.log(; // here 10 products (item) {
 // if i call some another rest api method here for each item - this will produces  10 async requests %)

  if (result.more()) {; // this will fetch next 10 products and make more request instantly!

i need to limit for 1 task
which libs exists for limit async task to 1 instance?

(Allan Dowdeswell) #2

Perhaps using Callback or Future from the Tink library would do the trick?