MCPcopy
hub / github.com/jsfiddle/togetherjs / printChained

Function printChained

togetherjs/tests/testutils.js:200–233  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

198};
199
200function printChained() {
201 var args = Array.prototype.slice.call(arguments);
202 var index = 0;
203 var done = false;
204 function run() {
205 if (index >= args.length) {
206 done = true;
207 return;
208 }
209 var f = args[index];
210 if (!f.then) { f = f(); }
211 f.then(function () {
212 if (! arguments.length) {
213 print("(done)");
214 } else {
215 print.apply(null, arguments);
216 }
217 check(1);
218 }, function () {
219 if (! arguments.length) {
220 print("(error)");
221 } else {
222 print.apply(null, ["Error:"].concat(arguments));
223 }
224 check(1);
225 });
226 function check(increment) {
227 index += increment;
228 setTimeout(run);
229 }
230 }
231 wait(function () {return done;});
232 run();
233}
234
235Test.incoming = function (msg) {
236 TogetherJSTestSpy.getChannel().onmessage(msg);

Callers 3

interactive.jsFile · 0.85
testutils.jsFile · 0.85

Calls 1

runFunction · 0.70

Tested by

no test coverage detected