Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return obj[key];
};
}
if (Object.getPrototypeOf(bobx) === undefined) {
return (bobx[key] as ObservableValue).prop();
}
bobx = asObservableClass(obj);
let val = bobx[key];
if (val === undefined) {
obj[key]; // Has side effect to create ObservableValue
val = bobx[key]!;
}
return val.prop();
}
var frameStart = b.now();
var outsideOfComputedPartialResults = false;
var alreadyInterrupted = false;
var firstInterruptibleCtx: IBobxCallerCtx | undefined;
var timeBudget = 10;
export function setTimeBudget(value: number) {
timeBudget = value;
}
export function getTimeBudget(): number {
return timeBudget;
}
var haveTimeBudget: () => boolean = () => b.now() - frameStart < timeBudget; // Spend only first 10ms from each frame in computed methods.
export function resetGotPartialResults() {
var haveTimeBudget: () => boolean = () => b.now() - frameStart < timeBudget; // Spend only first 10ms from each frame in computed methods.
var haveTimeBudget = function () { return b.now() - frameStart < 10; }; // Spend only first 10ms from each frame in computed methods.
function resetGotPartialResults() {
b.init(function () { return [
header({ fontSize: 20 }, bobril_g11n_1.t(0)),
warnHeader({ fontSize: 25, isWarning: true }, 'World'),
header({ fontSize: 15 }, bobril_g11n_1.t(1, { now: b.now() }))
]; });
function sleep(timeInMs: number) {
const start = b.now();
while (b.now() - start < timeInMs);
}
render(ctx: IToggleCtx, me: b.IBobrilNode) {
let d = ctx.data;
let disabled = d.disabled;
let checked = d.checked;
let focusFromKeyboard = ctx.focusFromKeyboard;
let hasRipple = ctx.rippleStart != 0;
let t: number = 0;
let r: number = 0;
if (hasRipple) {
t = (b.now() - ctx.rippleStart) * 0.004;
if (t > 2) {
hasRipple = false;
ctx.rippleStart = 0;
}
r = Math.min(t * toggleSize, toggleSize);
b.invalidate(ctx);
}
if (focusFromKeyboard) {
hasRipple = true;
r = toggleSize;
t = 1;
}
b.style(me, rootStyle, disabled ? disabledStyle : enabledStyle);
me.children = [
b.styledDiv(null, trackStyle, checked && trackToggledStyle, disabled && trackDisabledStyle),
b.styledDiv(hasRipple && b.styledDiv(null, rippleStyle, {
onPointerUp(ctx: IToggleCtx): boolean {
ctx.down = false;
b.releaseMouseOwner();
if (b.pointersDownCount() === 0 && !ctx.data.disabled) {
let a = ctx.data.action;
ctx.rippleStart = b.now();
if (a) a();
}
b.invalidate(ctx);
return true;
},
onKeyDown(ctx: IToggleCtx, ev: b.IKeyDownUpEvent): boolean {
function sleep(timeInMs: number) {
const start = b.now();
while (b.now() - start < timeInMs);
}
render(ctx: ICheckboxCtx, me: b.IBobrilNode) {
let d = ctx.data;
let ics = d.icons || checkBoxIcons;
ctx.radio = !!ics.radioButtonLike;
let disabled = d.disabled;
let checked = d.checked;
let indeterminate = d.indeterminate;
if (indeterminate === true) checked = false;
let focusFromKeyboard = ctx.focusFromKeyboard;
let rippleReq = focusFromKeyboard || ctx.down;
let time = b.now();
let rr = 0;
let ro = 0;
if (rippleReq && !ctx.rippleReq) {
ctx.rippleStart = time;
}
ctx.rippleReq = rippleReq;
let showFocus = false;
if (ctx.rippleStart !== 0) {
let t = (time - ctx.rippleStart) * 0.005;
if (t > (focusFromKeyboard ? 1.5 : 2)) {
if (focusFromKeyboard) showFocus = true;
if (!rippleReq) ctx.rippleStart = 0;
} else {
if (t < 1) {
ro = 0.4;
rr = 24 * t;
const previousReallyBeforeFrame = b.setReallyBeforeFrame(() => {
frameStart = b.now();
if (!alreadyInterrupted) {
buryWholeDeadSet();
}
alreadyInterrupted = false;
outsideOfComputedPartialResults = false;
firstInterruptibleCtx = undefined;
let iteration = 0;
while (iteration++ < maxIterations) {
let list = updateNextFrameList;
if (list.length == 0) break;
updateNextFrameList = [];
for (let i = 0; i < list.length; i++) {
list[i].updateIfNeededWithoutResurrecting();
}
}
if (iteration >= maxIterations) {