How to use the bobril.setCurrentCtx function in bobril

To help you get started, we’ve selected a few bobril examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bobril / bobx / index.js View on Github external
this.value = newResult;
            }
            else {
                isFirst = true;
            }
        }
        catch (err) {
            this.exception = err;
            this.value = undefined;
        }
        if (!isFirst)
            this.invalidate();
        if (alreadyInterrupted)
            this.partialResults = true;
        this.state = 3 /* Updated */;
        b.setCurrentCtx(backupCurrentCtx);
        if (this.partialResults) {
            this.state = 1 /* NeedRecheck */;
            setPartialResults();
        }
    };
    ComputedImpl.prototype.run = function () {
github bobril / bobx / index.ts View on Github external
update(): void {
        if (alreadyInterrupted && this.partialResults) {
            setPartialResults();
            return;
        }
        let backupCurrentCtx = b.getCurrentCtx();
        b.setCurrentCtx(this as any);
        this.partialResults = false;
        this.freeUsings();
        let wasChange = false;
        if (this.state === ComputedState.First) {
            this.state = ComputedState.Updated;
            this.value = this.call();
            wasChange = true;
        } else {
            this.state = ComputedState.Updated;
            let newResult = this.call();
            if (!this.comparator(this.value, newResult)) {
                this.value = newResult;
                wasChange = true;
            }
        }
github bobril / bobx / index.ts View on Github external
promiseFulfilled(value: any) {
        let backupCurrentCtx = b.getCurrentCtx();
        b.setCurrentCtx(this as any);
        this.state = ComputedState.Updating;
        try {
            this.iteratorNext(this.iterator!.next(value));
        } catch (err) {
            this.value = new CaughtException(err);
            this.state = ComputedState.Updated;
            this.invalidate();
        }
        b.setCurrentCtx(backupCurrentCtx);
    }
github bobril / bobx / index.ts View on Github external
return;
        }
        let backupCurrentCtx = b.getCurrentCtx();
        b.setCurrentCtx(this as any);
        this.partialResults = false;
        this.freeUsings();
        this.state = ComputedState.Updating;
        this.iterator = this.call();
        try {
            this.iteratorNext(this.iterator!.next());
        } catch (err) {
            this.value = new CaughtException(err);
            this.state = ComputedState.Updated;
            this.invalidate();
        }
        b.setCurrentCtx(backupCurrentCtx);
    }
github bobril / bobx / index.ts View on Github external
update(): void {
        if (alreadyInterrupted && this.partialResults) {
            setPartialResults();
            return;
        }
        let backupCurrentCtx = b.getCurrentCtx();
        b.setCurrentCtx(this as any);
        this.partialResults = false;
        this.freeUsings();
        if (this.state === ComputedState.First) {
            this.state = ComputedState.Updating;
            this.value = this.call();
        } else {
            this.state = ComputedState.Updating;
            let newResult = this.call();
            if (!this.comparator(this.value, newResult)) {
                this.value = newResult;
                this.invalidate();
            }
        }

        this.partialResults = alreadyInterrupted;
        this.state = ComputedState.Updated;
github bobril / bobx / index.ts View on Github external
promiseFulfilled(value: any) {
        let backupCurrentCtx = b.getCurrentCtx();
        b.setCurrentCtx(this as any);
        this.state = ComputedState.Updating;
        try {
            this.iteratorNext(this.iterator!.next(value));
        } catch (err) {
            this.value = new CaughtException(err);
            this.state = ComputedState.Updated;
            this.invalidate();
        }
        b.setCurrentCtx(backupCurrentCtx);
    }
github bobril / bobx / index.ts View on Github external
promiseFailed(err: any) {
        let backupCurrentCtx = b.getCurrentCtx();
        b.setCurrentCtx(this as any);
        this.state = ComputedState.Updating;
        try {
            this.iteratorNext(this.iterator!.throw!(err));
        } catch (err) {
            this.value = new CaughtException(err);
            this.state = ComputedState.Updated;
            this.invalidate();
        }
        b.setCurrentCtx(backupCurrentCtx);
    }
github bobril / bobx / index.ts View on Github external
promiseFailed(err: any) {
        let backupCurrentCtx = b.getCurrentCtx();
        b.setCurrentCtx(this as any);
        this.state = ComputedState.Updating;
        try {
            this.iteratorNext(this.iterator!.throw!(err));
        } catch (err) {
            this.value = new CaughtException(err);
            this.state = ComputedState.Updated;
            this.invalidate();
        }
        b.setCurrentCtx(backupCurrentCtx);
    }
github bobril / bobx / index.ts View on Github external
this.freeUsings();
        if (this.state === ComputedState.First) {
            this.state = ComputedState.Updating;
            this.value = this.call();
        } else {
            this.state = ComputedState.Updating;
            let newResult = this.call();
            if (!this.comparator(this.value, newResult)) {
                this.value = newResult;
                this.invalidate();
            }
        }

        this.partialResults = alreadyInterrupted;
        this.state = ComputedState.Updated;
        b.setCurrentCtx(backupCurrentCtx);
        if (this.partialResults) {
            this.state = ComputedState.NeedRecheck;
            setPartialResults();
        }
    }