Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.state !== 4 /* Scope */) {
if (this.state === 2 /* Updating */) {
throw new Error("Modifying inputs during updating computed");
}
if (this.state === 3 /* Updated */) {
this.state = 1 /* NeedRecheck */;
var usedBy = this.usedBy;
if (usedBy !== undefined) {
this.usedBy = undefined;
usedBy.forEach(function (comp) {
comp.invalidateBy(this.atomId);
}, this);
}
if (this.ctxs !== undefined) {
updateNextFrameList.push(this);
b.invalidate(bobxRootCtx);
}
}
}
this.freeUsings();
}
};
ComputedImpl.prototype.freeUsings = function () {
function setPartialResults() {
var ctx = b.getCurrentCtx();
if (ctx !== undefined) {
if (isIBobxComputed(ctx)) {
ctx.partialResults = true;
}
else {
b.invalidate(ctx);
}
}
outsideOfComputedPartialResults = true;
}
function gotPartialResults() {
export function reconnect() {
s.disconnected = false;
c.connect();
b.invalidate();
}
function interrupted() {
if (alreadyInterrupted)
return true;
var ctx = b.getCurrentCtx();
if (firstInterruptibleCtx === undefined)
firstInterruptibleCtx = ctx;
if (gotPartialResults()) {
return true;
}
if (!haveTimeBudget()) {
if (ctx === firstInterruptibleCtx) {
return false;
}
if (ctx !== undefined && !isIBobxComputed(ctx)) {
b.invalidate(ctx);
}
alreadyInterrupted = true;
firstInterruptibleCtx = undefined;
return true;
}
return false;
}
exports.interrupted = interrupted;
schedule(): void {
if (updateNextFrameList.length == 0) b.invalidate(bobxRootCtx);
updateNextFrameList.push(this);
}
function setPartialResults(): void {
const ctx = b.getCurrentCtx() as IBobxCallerCtx;
if (ctx !== undefined) {
if (isIBobxComputed(ctx)) {
ctx.partialResults = true;
} else {
b.invalidate(ctx);
}
}
outsideOfComputedPartialResults = true;
}
function toggleExpandItem(item: number) {
expanded = expanded === item ? 0 : item;
b.invalidate();
}
function handleRequestClose(ctx: IMenuItemCtx) {
ctx.open = false;
b.invalidate(ctx);
};
for (let i = 0; i < selectable.length; i++) {
if (this.selected === selectable[i]) {
found = true;
this.selectedIndex = i;
break;
}
}
if (!found) this.selected = undefined;
if (this.selected == undefined) {
this.selected = selectable[this.selectedIndex];
}
for (let i = 0; i < selectable.length; i++) {
let c = selectable[i];
if (c.focused != (focused && i == this.selectedIndex)) {
c.focused = !c.focused;
b.invalidate(c);
}
}
} else {
this.selectedIndex = -1;
this.selected = undefined;
}
}
onKeyDown(ctx: IToggleCtx, ev: b.IKeyDownUpEvent): boolean {
if (ev.which === 32 && !ctx.data.disabled && ctx.focusFromKeyboard) {
ctx.down = true;
b.invalidate(ctx);
return true;
}
if (ev.which === 13 && !ctx.data.disabled && ctx.focusFromKeyboard) {
let a = ctx.data.action;
if (a) a();
return true;
}
return false;
},
onKeyUp(ctx: IToggleCtx, ev: b.IKeyDownUpEvent): boolean {