How to use the @politie/sherlock._internal.Reactor function in @politie/sherlock

To help you get started, we’ve selected a few @politie/sherlock 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 politie / sherlock / extensions / sherlock-utils / src / control-flow.ts View on Github external
skipFirst = false;
                } else {
                    once && stop();
                    const oldState = this._currentState;
                    this._currentState = fromStateObject(newState);
                    _internal.processChangedAtom(this, oldState, this.version++);
                }
            }
        };
        const cleanup = () => {
            alreadyStopped = true;
            this._baseConnectionStopper = undefined;
        };

        const mBase = materialize(this.base) as _internal.BaseDerivable>;
        const stopper = _internal.Reactor.create(mBase, update, opts, cleanup);
        if (!alreadyStopped) {
            this._baseConnectionStopper = stopper;
        }

        super[_internal.symbols.connect]();
    }
github politie / sherlock / extensions / sherlock-rxjs / rxjs.ts View on Github external
return new Observable((subscriber: Subscriber) => {
        return _internal.Reactor.create(derivable as _internal.BaseDerivable,
            value => subscriber.next(value),
            options,
            () => subscriber.closed || subscriber.complete(),
        );
    });
}