ixfx
    Preparing search index...

    Type Alias Wrapped<TIn>

    Wrapped: {
        annotate: <TAnnotation>(
            transformer: (value: TIn) => TAnnotation,
        ) => Wrapped<{ annotation: TAnnotation; value: TIn }>;
        annotateWithOp: <TOut>(
            op: ReactiveOp<TIn, TOut>,
        ) => Wrapped<{ annotation: TOut; value: TIn }>;
        average: (options?: Partial<OpMathOptions>) => Wrapped<number>;
        chunk: (options: Partial<ChunkOptions>) => Wrapped<TIn[]>;
        combineLatestToArray: <
            const T extends ReadonlyArray<ReactiveOrSource<any>>,
        >(
            sources: T,
            options: Partial<Rx.CombineLatestOptions>,
        ) => Wrapped<RxValueTypes<T>>;
        combineLatestToObject: <
            const T extends Record<string, ReactiveOrSource<any>>,
        >(
            sources: T,
            options: { name: string } & Partial<Rx.CombineLatestOptions>,
        ) => Wrapped<RxValueTypeObject<T>>;
        debounce: (options: Partial<DebounceOptions>) => Wrapped<TIn>;
        enacts: { setHtmlText: (options: SetHtmlOptions) => () => void };
        field: <TSource, TFieldType>(
            fieldName: keyof TIn,
            options: Partial<FieldOptions<TSource, TFieldType>>,
        ) => Wrapped<TFieldType>;
        filter: (
            predicate: FilterPredicate<TIn>,
            options: Partial<InitStreamOptions>,
        ) => Wrapped<TIn>;
        max: (options?: Partial<OpMathOptions>) => Wrapped<number>;
        min: (options?: Partial<OpMathOptions>) => Wrapped<number>;
        onValue: (callback: (value: TIn) => void) => void;
        source: Reactive<TIn>;
        split: (options?: Partial<SplitOptions>) => Wrapped<TIn>[];
        splitLabelled: <K extends keyof TIn>(
            ...labels: K[],
        ) => Record<K, Wrapped<TIn>>;
        sum: (options?: Partial<OpMathOptions>) => Wrapped<number>;
        switcher: <
            TRec extends Record<string, FilterPredicate<TIn>>,
            TLabel extends keyof TRec,
        >(
            cases: TRec,
            options: Partial<SwitcherOptions>,
        ) => Record<TLabel, Wrapped<TIn>>;
        syncToArray: <const T extends ReadonlyArray<ReactiveOrSource<any>>>(
            reactiveSources: T,
            options?: Partial<Rx.SyncOptions>,
        ) => Wrapped<[TIn, ...RxValueTypes<T>]>;
        syncToObject: <const T extends Record<string, ReactiveOrSource<any>>>(
            reactiveSources: T,
            options?: { name?: string } & Partial<Rx.SyncOptions>,
        ) => Wrapped<RxValueTypeObject<T>>;
        tally: (options?: Partial<TallyOptions>) => Wrapped<number>;
        tapOps: <TOut>(
            source: ReactiveOrSource<TIn>,
            ...ops: ReactiveOp<TIn, TOut>[],
        ) => Wrapped<TIn>;
        tapProcess: <T2, T3, T4, T5, T6>(
            ...processors: Processors<TIn, T2, T3, T4, T5, T6>,
        ) => Wrapped<TIn>;
        tapStream: (divergedStream: ReactiveWritable<TIn>) => Wrapped<TIn>;
        throttle: (options: Partial<ThrottleOptions>) => Wrapped<TIn>;
        timeoutPing: (options: TimeoutPingOptions) => Wrapped<TIn>;
        timeoutValue: <TTriggerValue>(
            options: TimeoutValueOptions<TTriggerValue>,
        ) => Wrapped<TIn | TTriggerValue>;
        toArray: (
            options: Partial<Rx.ToArrayOptions<TIn>>,
        ) => Promise<(TIn | undefined)[]>;
        toArrayOrThrow: (
            options: Partial<Rx.ToArrayOptions<TIn>>,
        ) => Promise<TIn[]>;
        transform: <TOut>(
            transformer: (value: TIn) => TOut,
            options?: Partial<TransformOpts>,
        ) => Wrapped<TOut>;
    }

    Wrapped Reactive for object-oriented access

    Type Parameters

    • TIn

    Type declaration

    • annotate: <TAnnotation>(
          transformer: (value: TIn) => TAnnotation,
      ) => Wrapped<{ annotation: TAnnotation; value: TIn }>

      Annotate values with output from the annotation function. Returned values will be in the form { value:TIn, annotation:TAnnotation }

    • annotateWithOp: <TOut>(op: ReactiveOp<TIn, TOut>) => Wrapped<{ annotation: TOut; value: TIn }>
    • average: (options?: Partial<OpMathOptions>) => Wrapped<number>
    • chunk: (options: Partial<ChunkOptions>) => Wrapped<TIn[]>

      Accumulate a chunk of values, emitted as an array

    • combineLatestToArray: <const T extends ReadonlyArray<ReactiveOrSource<any>>>(
          sources: T,
          options: Partial<Rx.CombineLatestOptions>,
      ) => Wrapped<RxValueTypes<T>>
    • combineLatestToObject: <const T extends Record<string, ReactiveOrSource<any>>>(
          sources: T,
          options: { name: string } & Partial<Rx.CombineLatestOptions>,
      ) => Wrapped<RxValueTypeObject<T>>
    • debounce: (options: Partial<DebounceOptions>) => Wrapped<TIn>
    • enacts: { setHtmlText: (options: SetHtmlOptions) => () => void }
    • field: <TSource, TFieldType>(
          fieldName: keyof TIn,
          options: Partial<FieldOptions<TSource, TFieldType>>,
      ) => Wrapped<TFieldType>

      Pluck and emit a single field from values

    • filter: (
          predicate: FilterPredicate<TIn>,
          options: Partial<InitStreamOptions>,
      ) => Wrapped<TIn>

      Throws away values that don't match predicate

    • max: (options?: Partial<OpMathOptions>) => Wrapped<number>
    • min: (options?: Partial<OpMathOptions>) => Wrapped<number>
    • onValue: (callback: (value: TIn) => void) => void

      Listen for values

    • source: Reactive<TIn>
    • split: (options?: Partial<SplitOptions>) => Wrapped<TIn>[]

      Converts one source stream into two, with values being emitted by both

    • splitLabelled: <K extends keyof TIn>(...labels: K[]) => Record<K, Wrapped<TIn>>

      Creates new streams for each case

    • sum: (options?: Partial<OpMathOptions>) => Wrapped<number>
    • switcher: <TRec extends Record<string, FilterPredicate<TIn>>, TLabel extends keyof TRec>(
          cases: TRec,
          options: Partial<SwitcherOptions>,
      ) => Record<TLabel, Wrapped<TIn>>

      Creates new streams for each case, sending values to the stream if they match the filter predicate

    • syncToArray: <const T extends ReadonlyArray<ReactiveOrSource<any>>>(
          reactiveSources: T,
          options?: Partial<Rx.SyncOptions>,
      ) => Wrapped<[TIn, ...RxValueTypes<T>]>

      Emits values when this stream and any additional streams produce a value. The resulting stream is thus an array of values, each source at a given index. Waits to output a value until each stream has produced a value. Thus, the pace is determined by the slowest stream.

    • syncToObject: <const T extends Record<string, ReactiveOrSource<any>>>(
          reactiveSources: T,
          options?: { name?: string } & Partial<Rx.SyncOptions>,
      ) => Wrapped<RxValueTypeObject<T>>
    • tally: (options?: Partial<TallyOptions>) => Wrapped<number>
    • tapOps: <TOut>(
          source: ReactiveOrSource<TIn>,
          ...ops: ReactiveOp<TIn, TOut>[],
      ) => Wrapped<TIn>
    • tapProcess: <T2, T3, T4, T5, T6>(
          ...processors: Processors<TIn, T2, T3, T4, T5, T6>,
      ) => Wrapped<TIn>

      Taps the stream, passing values to one or more 'processor' functions. This processing essentially happens in parallel, not affecting the main stream.

      // Stream of pointermove events with {x:0,y:0} as default
      const move = Rx.From.event(document.body, `pointermove`, {x:0,y:0});
      // Wrap it for fluent access
      const ptr = Rx.wrap(move)
      .tapProcess(
      // Create a string representation
      v => `${v.x},${v.y}`
      // Set to DOM
      v => {
      document.getElementById(`coords`).innerText = v;
      }
      )
      .onValue(value => {
      // 'value' will be original PointerEvent, since .tapProcess happened in parallel,
      // not affecting stream
      });
    • tapStream: (divergedStream: ReactiveWritable<TIn>) => Wrapped<TIn>
    • throttle: (options: Partial<ThrottleOptions>) => Wrapped<TIn>

      Only allow values through if a minimum of time has elapsed. Throws away values. Ie. converts a fast stream into a slower one.

    • timeoutPing: (options: TimeoutPingOptions) => Wrapped<TIn>

      'Pings' reactive (if it supports it) if a value is not received within a given interval. Behaviour can be stopped using an abort signal.

    • timeoutValue: <TTriggerValue>(
          options: TimeoutValueOptions<TTriggerValue>,
      ) => Wrapped<TIn | TTriggerValue>

      Emits a value if source does not emit a value after interval has elapsed. This can be useful to reset a reactive to some 'zero' state if nothing is going on.

      If source emits faster than the interval, it won't get triggered.

      Default for 'timeout': 1000s.

      // Emit 'hello' if 'source' doesn't emit a value after 1 minute
      const r = Rx.timeoutValue(source, { value: 'hello', interval: { mins: 1 } });

      Can also emit results from a function or generator

      // Emits a random number if 'source' doesn't emit a value after 500ms
      const r = Rx.timeoutValue(source, { fn: Math.random, interval: 500 });

      If immediate option is true (default), the timer starts from stream initialisation. Otherwise it won't start until it observes the first value from source.

    • toArray: (options: Partial<Rx.ToArrayOptions<TIn>>) => Promise<(TIn | undefined)[]>

      Copies values from source into an array.

    • toArrayOrThrow: (options: Partial<Rx.ToArrayOptions<TIn>>) => Promise<TIn[]>

      Copies values from source into an array, throwing an error if expected number of items is not reached

    • transform: <TOut>(
          transformer: (value: TIn) => TOut,
          options?: Partial<TransformOpts>,
      ) => Wrapped<TOut>

      Transforms all values