jquery - Loop pause with Q -
I'm using Q for some sequence of jQuery sequential processing in the text (). Now I've added a break button to temporarily stop the processing inside the Promise is still asynchronous in this case. You can not just do the You need the series to promise promise instead of promise. It reads in this form: Continue with the era of poll in the present era, which delays up to 300 milliseconds, and repeats itself (call itself) till now Not true. Note Definitely it would be better forEach loop, but if I
inside an
promise.delay (300) < / code> Add -loop (see partial code below) My browser is hanging
var promise = new Q (); How do I apply a conditional block on a
forEach loop in Boolean
ispaused using Q? Promise = promise Then (function () {lines.forEach (function (item) {// start hanging in the browser if it is then imposed == true promise = promise. Then (function () {while (status) {promise = promise Delay (300);}}) None of the following work, while // (status) {// promise = promise .Delay (300); //} // following either // work If not (IsPaused) {// Q.delay (300); //} (item [0] == '%') {promise = promise. Then (function () {return addprrompt (wnd);} ) Promise = promise again (function () (addoinput (item.substr (1))}}} other {promise = wa Then (function () {addOutput (item, wnd)}}}}}}); Promise = promise then (function () {return addPrompt (wnd);}}}); promise.done ();
While (True)
while (position) {/ * block which is plain old browser javascript in 'condition' / * } . The code that changes is paused in your case and you will never get the opportunity to execute it. (Well, you can do with ES6 generator which gives you explicit control, but this OT is here).
promise = promise. Then (function pollUntil () {return Q.delay (300) .then (function () {// recursively chain here the continuity. MS / // will check. Return: pollUntil (): true;});});
break () to promise which will solve you now while not halted.
Comments
Post a Comment