javascript - Node.js meteor.js fibers and loop -


okay learning fibers , dont know how implement "waiting end of loop inside fiber"

now have code works without problem.

        if (meteor.isserver) {          function checkifiownthisitem(callback) {            settimeout(function() {                 callback("this callback");             }, 500);         }                     var f = fiber(function() {             var fiber = fiber.current;              checkifiownthisitem(function(str) {                 fiber.run(str);             });              str = fiber.yield();             console.log(str);         });          f.run();      } 

and need replace settimeout ...for...

        _.each(mybank.items,function(loopitem,key,list){         if (loopitem.itemid == item.itemid) {             ownitem = true;             countofowniteminbank = parseint(loopitem.number);         }     });  

the whole point first check if own item (own item true) , can whatever hell want need sure ownitem true

it sounds starting memories fibers/threads in desktop programming , trying map exact equivalence. remember world. don't think way. fibers more not waiting around answer come time.

i bet if take smaller steps, think less, , html/js want, come here when hit stopping block, make progress.

ownership of items, example, commonly expressed field in document, ownerid, matching current userid


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -