Compartir a través de


Control.Event Module (F#)

Provides functions for managing event streams.

Namespace/Module Path: Microsoft.FSharp.Control

Assembly: FSharp.Core (in FSharp.Core.dll)

module Event

Values

Value

Description

add : ('T -> unit) -> Event<'Del,'T> -> unit

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

choose : ('T -> 'U option) -> IEvent<'Del,'T> -> IEvent<'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.

filter : ('T -> bool) -> IEvent<'Del,'T> -> IEvent<'T>

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.

map : ('T -> 'U) -> IEvent<'Del, 'T> -> IEvent<'U>

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

merge : IEvent<'Del1,'T> -> IEvent<'Del2,'T> -> IEvent<'T>

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

pairwise : IEvent<'Del,'T> -> IEvent<'T * 'T>

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.

partition : ('T -> bool) -> IEvent<'Del,'T> -> IEvent<'T> * IEvent<'T>

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.

scan : ('U -> 'T -> 'U) -> 'U -> IEvent<'Del,'T> -> IEvent<'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.

split : ('T -> Choice<'U1,'U2>) -> IEvent<'Del,'T> -> IEvent<'U1> * IEvent<'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.

Platforms

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

See Also

Reference

Microsoft.FSharp.Control Namespace (F#)

Control.Event<'T> Class (F#)

Control.IEvent<'Delegate,'Args> Interface (F#)

Other Resources

Events (F#)