Header menu logo FSharp.Core.Fluent

EventExtensions Module

Fluent extension operations on events.

Type extensions

Type extension Description

this.add callback

Full Usage: this.add callback

Parameters:
    callback : 'T -> unit - The function to call when the event is triggered.

Modifiers: inline

Runs the given function each time the given event is triggered.

Extended Type: IEvent

callback : 'T -> unit

The function to call when the event is triggered.

this.choose chooser

Full Usage: this.choose chooser

Parameters:
    chooser : 'T -> 'U option - The function to select and transform event values to pass on.

Returns: IEvent<'U> An event that fires only when the chooser returns Some.
Modifiers: inline
Type parameters: 'U

Returns a new event which fires on a selection of messages from the original event. The selection function takes an original message to an optional new message.

Extended Type: IEvent

chooser : 'T -> 'U option

The function to select and transform event values to pass on.

Returns: IEvent<'U>

An event that fires only when the chooser returns Some.

this.filter predicate

Full Usage: this.filter predicate

Parameters:
    predicate : 'T -> bool - The function to determine which triggers from the event to propagate.

Returns: IEvent<'T> An event that only passes values that pass the predicate.
Modifiers: inline

Returns a new event that listens to the original event and triggers the resulting event only when the argument to the event passes the given function.

Extended Type: IEvent

predicate : 'T -> bool

The function to determine which triggers from the event to propagate.

Returns: IEvent<'T>

An event that only passes values that pass the predicate.

this.map mapping

Full Usage: this.map mapping

Parameters:
    mapping : 'T -> 'U - The function to transform event values.

Returns: IEvent<'U> An event that passes the transformed values.
Modifiers: inline
Type parameters: 'U

Returns a new event that passes values transformed by the given function.

Extended Type: IEvent

mapping : 'T -> 'U

The function to transform event values.

Returns: IEvent<'U>

An event that passes the transformed values.

this.merge evt2

Full Usage: this.merge evt2

Parameters:
    evt2 : IEvent<'Del2, 'T> - The second input event.

Returns: IEvent<'T> An event that fires when either of the input events fire.
Modifiers: inline
Type parameters: 'Del2

Fires the output event when either of the input events fire.

Extended Type: IEvent

evt2 : IEvent<'Del2, 'T>

The second input event.

Returns: IEvent<'T>

An event that fires when either of the input events fire.

this.pairwise ()

Full Usage: this.pairwise ()

Parameters:
    () : unit

Returns: IEvent<'T * 'T> An event that triggers on pairs of consecutive values passed from the source event.
Modifiers: inline

Returns a new event that triggers on the second and subsequent triggerings of the input event. The Nth triggering of the input event passes the arguments from the N-1th and Nth triggering as a pair. The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.

Extended Type: IEvent

() : unit
Returns: IEvent<'T * 'T>

An event that triggers on pairs of consecutive values passed from the source event.

this.partition predicate

Full Usage: this.partition predicate

Parameters:
    predicate : 'T -> bool - The function to determine which output event to trigger.

Returns: IEvent<'T> * IEvent<'T> A tuple of events. The first is triggered when the predicate evaluates to true and the second when the predicate evaluates to false.
Modifiers: inline

Returns a new event that listens to the original event and triggers the first resulting event if the application of the predicate to the event arguments returned true, and the second event if it returned false.

Extended Type: IEvent

predicate : 'T -> bool

The function to determine which output event to trigger.

Returns: IEvent<'T> * IEvent<'T>

A tuple of events. The first is triggered when the predicate evaluates to true and the second when the predicate evaluates to false.

this.scan (state, collector)

Full Usage: this.scan (state, collector)

Parameters:
    state : 'U - The initial state.
    collector : 'U -> 'T -> 'U - The function to update the state with each event value.

Returns: IEvent<'U> An event that fires on the updated state values.
Modifiers: inline
Type parameters: 'U

Returns a new event consisting of the results of applying the given accumulating function to successive values triggered on the input event. An item of internal state records the current value of the state parameter. The internal state is not locked during the execution of the accumulation function, so care should be taken that the input IEvent not triggered by multiple threads simultaneously.

Extended Type: IEvent

state : 'U

The initial state.

collector : 'U -> 'T -> 'U

The function to update the state with each event value.

Returns: IEvent<'U>

An event that fires on the updated state values.

this.split splitter

Full Usage: this.split splitter

Parameters:
    splitter : 'T -> Choice<'U1, 'U2> - The function to transform event values into one of two types.

Returns: IEvent<'U1> * IEvent<'U2> A tuple of events. The first fires whenever splitter evaluates to Choice1of1 and the second fires whenever splitter evaluates to Choice2of2.
Modifiers: inline
Type parameters: 'U1, 'U2

Returns a new event that listens to the original event and triggers the first resulting event if the application of the function to the event arguments returned a Choice1Of2, and the second event if it returns a Choice2Of2.

Extended Type: IEvent

splitter : 'T -> Choice<'U1, 'U2>

The function to transform event values into one of two types.

Returns: IEvent<'U1> * IEvent<'U2>

A tuple of events. The first fires whenever splitter evaluates to Choice1of1 and the second fires whenever splitter evaluates to Choice2of2.

Type something to start searching.