\x89PNG\r\n\x1a\n\x00\x00\x00\x0DIHDR\x00\x00\x00\x01\x00 \x00\x00\x01\x08\x06\x00\x00\x00\x1F\x15\xC4\x89\x00\x00\x00 \x0AIDATx\x9Ccb\x00\x00\x00\x06\x00\x03\x1A\x05\x9D\x00\x00 \x00\x00IEND\xAE\x42\x60\x82 csarite.com
KUJUNTI.ID MINISH3LL
Path : /var/www/html/infraai.ai/frontend/node_modules/thingies/lib/
(S)h3ll Cr3at0r :
F!le Upl0ad :

B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H

Current File : /var/www/html/infraai.ai/frontend/node_modules/thingies/lib/sync.js


"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.comp = exports.val = exports.Computed = exports.Value = void 0;
const fanout_1 = require("./fanout");
const NO_CACHE = Symbol();
class Value extends fanout_1.FanOut {
    constructor(value) {
        super();
        /** ----------------------------------------------------- {@link SyncStore} */
        this.subscribe = (cb) => this.listen(cb);
        this.getSnapshot = () => this.value;
        this.value = value;
    }
    next(value, force = false) {
        if (!force && this.value === value)
            return;
        this.value = value;
        this.emit();
    }
}
exports.Value = Value;
class Computed extends fanout_1.FanOut {
    constructor(deps, compute) {
        super();
        this.deps = deps;
        this.compute = compute;
        this.cache = NO_CACHE;
        /** ----------------------------------------------------- {@link SyncStore} */
        this.subscribe = (cb) => this.listen(cb);
        this.getSnapshot = () => this._comp();
        const subs = (this.subs = []);
        const length = deps.length;
        for (let i = 0; i < length; i++) {
            const dep = deps[i];
            const sub = dep.listen(() => {
                this.cache = NO_CACHE;
                this.emit();
            });
            subs.push(sub);
        }
    }
    _comp() {
        const cached = this.cache;
        if (cached !== NO_CACHE)
            return cached;
        return (this.cache = this.compute(this.deps.map((dep) => dep.getSnapshot())));
    }
    /** ----------------------------------------------------- {@link SyncValue} */
    get value() {
        return this._comp();
    }
    /** ---------------------------------------------------- {@link Disposable} */
    dispose() {
        for (const sub of this.subs)
            sub();
    }
}
exports.Computed = Computed;
const val = (initial) => new Value(initial);
exports.val = val;
const comp = (deps, compute) => new Computed(deps, compute);
exports.comp = comp;

© KUJUNTI.ID