()
| 198 | }; |
| 199 | |
| 200 | function 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 | |
| 235 | Test.incoming = function (msg) { |
| 236 | TogetherJSTestSpy.getChannel().onmessage(msg); |
no test coverage detected