deferred/test/ext/function/delay.js
raw| 1 | "use strict"; |
| 2 | |
| 3 | module.exports = function (t, a, d) { |
| 4 | var x = {}, y = {}, z = {}, p, r; |
| 5 | t.call(function (arg1, arg2) { return [this, arg1, arg2]; }, 100) |
| 6 | .call(x, y, z)(function (arg) { |
| 7 | p = y; |
| 8 | r = arg; |
| 9 | }) |
| 10 | .done(); |
| 11 | a.not(p, y, "Not yet"); |
| 12 | setTimeout(function () { |
| 13 | a.not(p, y, "After a while"); |
| 14 | setTimeout(function () { |
| 15 | a(p, y, "Timed"); |
| 16 | a.deep(r, [x, y, z], "Result"); |
| 17 | d(); |
| 18 | }, 70); |
| 19 | }, 50); |
| 20 | }; |