* Run all tasks sequentially, at convince * @return {Promise}
()
| 115 | * @return {Promise} |
| 116 | */ |
| 117 | run() { |
| 118 | if (!this.running) { |
| 119 | this.running = true |
| 120 | this.defered = new defer() |
| 121 | } |
| 122 | |
| 123 | this.tick.call(window, () => { |
| 124 | if (this._q.length) { |
| 125 | this.dequeue().then( |
| 126 | function () { |
| 127 | this.run() |
| 128 | }.bind(this), |
| 129 | ) |
| 130 | } else { |
| 131 | this.defered.resolve() |
| 132 | this.running = undefined |
| 133 | } |
| 134 | }) |
| 135 | |
| 136 | // Unpause |
| 137 | if (this.paused == true) { |
| 138 | this.paused = false |
| 139 | } |
| 140 | |
| 141 | return this.defered.promise |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Flush all, as quickly as possible |
no test coverage detected