Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
35 lines
950 B
Plaintext
35 lines
950 B
Plaintext
function createLazyMeasurementsView(count, flat, getItemKey) {
|
|
const cache = new Array(count);
|
|
return new Proxy(cache, {
|
|
get(target, prop, receiver) {
|
|
if (typeof prop === "string") {
|
|
const c = prop.charCodeAt(0);
|
|
if (c >= 48 && c <= 57) {
|
|
const i = +prop;
|
|
if (Number.isInteger(i) && i >= 0 && i < count) {
|
|
let v = target[i];
|
|
if (!v) {
|
|
const s = flat[i * 2];
|
|
v = target[i] = {
|
|
index: i,
|
|
key: getItemKey(i),
|
|
start: s,
|
|
size: flat[i * 2 + 1],
|
|
end: s + flat[i * 2 + 1],
|
|
lane: 0
|
|
};
|
|
}
|
|
return v;
|
|
}
|
|
}
|
|
if (prop === "length") return count;
|
|
}
|
|
return Reflect.get(target, prop, receiver);
|
|
}
|
|
});
|
|
}
|
|
export {
|
|
createLazyMeasurementsView
|
|
};
|
|
//# sourceMappingURL=lazy-measurements.js.map
|