How to use the @politie/sherlock._internal.BaseDerivable 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
/**
     * When `true` the derivable will not update the first time it receives an update from the parent derivable. After that it has no effect.
     */
    skipFirst?: boolean;

    /*
     * Indicates whether an update to unresolved state is considered an update. Default: false.
     */
    includeUnresolved?: boolean;
}

// tslint:disable-next-line:ban-types
type PreparedOptions = { [P in keyof ControlFlowOptions]?: Exclude[P], Function> };

class ControlFlow extends _internal.BaseDerivable implements Derivable {
    private readonly opts: PreparedOptions;

    constructor(
        private readonly base: Derivable,
        opts?: ControlFlowOptions,
    ) {
        super();
        this.opts = prepareOptions(base, opts);
    }

    /**
     * The last state that was calculated for this derivable. Is only used when connected.
     * @internal
     */
    private _currentState: State = unresolved;