()
| 2184 | }; |
| 2185 | |
| 2186 | var performWorkUntilDeadline = function () { |
| 2187 | if (scheduledHostCallback !== null) { |
| 2188 | var currentTime = getCurrentTime(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync |
| 2189 | // cycle. This means there's always time remaining at the beginning of |
| 2190 | // the message event. |
| 2191 | |
| 2192 | deadline = currentTime + yieldInterval; |
| 2193 | var hasTimeRemaining = true; |
| 2194 | |
| 2195 | try { |
| 2196 | var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); |
| 2197 | |
| 2198 | if (!hasMoreWork) { |
| 2199 | isMessageLoopRunning = false; |
| 2200 | scheduledHostCallback = null; |
| 2201 | } else { |
| 2202 | // If there's more work, schedule the next message event at the end |
| 2203 | // of the preceding one. |
| 2204 | port.postMessage(null); |
| 2205 | } |
| 2206 | } catch (error) { |
| 2207 | // If a scheduler task throws, exit the current browser task so the |
| 2208 | // error can be observed. |
| 2209 | port.postMessage(null); |
| 2210 | throw error; |
| 2211 | } |
| 2212 | } else { |
| 2213 | isMessageLoopRunning = false; |
| 2214 | } // Yielding to the browser will give it a chance to paint, so we can |
| 2215 | }; |
| 2216 | |
| 2217 | var channel = new MessageChannel(); |
| 2218 | var port = channel.port2; |
nothing calls this directly
no test coverage detected