MCPcopy Index your code
hub / github.com/ether/etherpad / incrementBar

Function incrementBar

src/tests/frontend/runner.js:255–264  ·  view source on GitHub ↗
(amount = 1)

Source from the content-addressed store, hash-verified

253 const $bar = $('<progress>');
254 let barLastUpdate = Date.now();
255 const incrementBar = async (amount = 1) => {
256 $bar.attr('value', Number.parseInt($bar.attr('value')) + 1);
257 // Give the browser an opportunity to draw the progress bar's new length. `await
258 // Promise.resolve()` isn't enough, so a timeout is used. Sleeping every increment (even 0ms)
259 // unnecessarily slows down spec loading so the sleep is occasional.
260 if (Date.now() - barLastUpdate > 100) {
261 await new Promise((resolve) => setTimeout(resolve, 0));
262 barLastUpdate = Date.now();
263 }
264 };
265 const $progressArea = $('<div>')
266 .css({'display': 'flex', 'flex-direction': 'column', 'height': '100%'})
267 .append($('<div>').css({flex: '1 0 0'}))

Callers 1

runner.jsFile · 0.85

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected