[Home] Module Microsoft.FSharp.Control.Event


Basic operations on IEvents.

Values

ValueDescription
val choose :
  ('a -> 'b option) -> IEvent<'del,'a> -> IEvent<'b>
    (requires delegate and 'del :> Delegate)
Return 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.
val create : unit -> ('a -> unit) * IEvent<'a>
Create an IEvent with no initial listeners. Two items are returned: a function to invoke (trigger) the event, and the event that clients can plug listeners into.
val filter :
  ('a -> bool) -> IEvent<'del,'a> -> IEvent<'a>
    (requires delegate and 'del :> Delegate)
Return 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
val listen :
  ('a -> unit) -> IEvent<'del,'a> -> unit
    (requires delegate and 'del :> Delegate)
Run the given function each time the given event is triggered.
val map :
  ('a -> 'b) -> IEvent<'del,'a> -> IEvent<'b>
    (requires delegate and 'del :> Delegate)
Return a new event that passes values transformed by the given function
val merge :
  IEvent<'del1,'a> -> IEvent<'del2,'a> -> IEvent<'a>
    (requires delegate and 'del1 :> Delegate and delegate and 'del2 :> Delegate)
Fire the output event when either of the input events fire
val pairwise :
  IEvent<'del,'a> -> IEvent<'a * 'a>
    (requires delegate and 'del :> Delegate)
Return 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. You should ensure that the contents of the values being sent down the event are not mutable. Note that many EventArgs types are mutable, e.g. MouseEventArgs, and each firing of an event using this argument type may reuse the same physical argument obejct with different values. In this case you should extract the necessary information from the argument before using this combinator.
val partition :
  ('a -> bool) -> IEvent<'del,'a> -> IEvent<'a> * IEvent<'a>
    (requires delegate and 'del :> Delegate)
Return 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
val scan :
  ('b -> 'a -> 'b) -> 'b -> IEvent<'del,'a> -> IEvent<'b>
    (requires delegate and 'del :> Delegate)
Return 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.
val split :
  ('a -> Choice<'b,'c>) -> IEvent<'del,'a> ->
  IEvent<'b> * IEvent<'c> (requires delegate and 'del :> Delegate)
Return 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 Choice2_1, and the second event if it returns a Choice2_2

See Also

Microsoft.FSharp.Control


Documentation for assembly FSharp.Core, version 1.9.6.0, generated using F# Programming Language version 1.9.6.0