render at least 10 style entries on slower machines
This commit is contained in:
parent
3a8ac2d9dc
commit
a80c677b3e
|
@ -204,7 +204,7 @@ rules:
|
||||||
no-undefined: [0]
|
no-undefined: [0]
|
||||||
no-underscore-dangle: [0]
|
no-underscore-dangle: [0]
|
||||||
no-unexpected-multiline: [2]
|
no-unexpected-multiline: [2]
|
||||||
no-unmodified-loop-condition: [2]
|
no-unmodified-loop-condition: [1]
|
||||||
no-unneeded-ternary: [2]
|
no-unneeded-ternary: [2]
|
||||||
no-unreachable: [2]
|
no-unreachable: [2]
|
||||||
no-unsafe-finally: [2]
|
no-unsafe-finally: [2]
|
||||||
|
|
|
@ -104,11 +104,10 @@ function showStyles(styles = []) {
|
||||||
|
|
||||||
function renderStyles(index) {
|
function renderStyles(index) {
|
||||||
const t0 = performance.now();
|
const t0 = performance.now();
|
||||||
while (index < sorted.length) {
|
let rendered = 0;
|
||||||
|
while (index < sorted.length
|
||||||
|
&& (shouldRenderAll || performance.now() - t0 < 10 || ++rendered < 10)) {
|
||||||
renderBin.appendChild(createStyleElement(sorted[index++]));
|
renderBin.appendChild(createStyleElement(sorted[index++]));
|
||||||
if (!shouldRenderAll && performance.now() - t0 > 10) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
filterAndAppend({container: renderBin});
|
filterAndAppend({container: renderBin});
|
||||||
if (index < sorted.length) {
|
if (index < sorted.length) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user