Header menu logo FSharp.Core

Event Module

Contains operations for working with values of type IEvent.

Functions and values

Function or value Description

Event.add callback sourceEvent

Full Usage: Event.add callback sourceEvent

Parameters:
    callback : 'T -> unit - The function to call when the event is triggered.
    sourceEvent : IEvent<'Del, 'T> - The input event.

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

callback : 'T -> unit

The function to call when the event is triggered.

sourceEvent : IEvent<'Del, 'T>

The input event.

Example

 open System

 let createTimer interval =
     let timer = new Timers.Timer(interval)
     timer.AutoReset <- true
     timer.Enabled <- true
     timer.Elapsed

 let timer = createTimer 1000

 Event.add (fun (event: Timers.ElapsedEventArgs) -> printfn $"{event.SignalTime} ")  timer

 Console.ReadLine() |> ignore
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ...
<summary>Generates an event after a set interval, with an option to generate recurring events.</summary>

--------------------
Timers.Timer() : Timers.Timer
Timers.Timer(interval: float) : Timers.Timer
Timers.Timer(interval: TimeSpan) : Timers.Timer
property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns>
property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>
<exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control

--------------------
type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args>

--------------------
new: unit -> Event<'T>

--------------------
new: unit -> Event<'Delegate,'Args>
val add: callback: ('T -> unit) -> sourceEvent: IEvent<'Del,'T> -> unit (requires delegate and 'Del :> Delegate)
val event: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime
<summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>

--------------------
Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary>
<returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns>
type Console = static member Beep: unit -> unit + 1 overload static member Clear: unit -> unit static member GetCursorPosition: unit -> struct (int * int) static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload static member OpenStandardError: unit -> Stream + 1 overload static member OpenStandardInput: unit -> Stream + 1 overload static member OpenStandardOutput: unit -> Stream + 1 overload static member Read: unit -> int static member ReadKey: unit -> ConsoleKeyInfo + 1 overload static member ReadLine: unit -> string ...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
val ignore: value: 'T -> unit
The sample will output the timer event every second: 2/14/2022 11:52:05 PM 2/14/2022 11:52:06 PM 2/14/2022 11:52:07 PM 2/14/2022 11:52:08 PM

Event.choose chooser sourceEvent

Full Usage: Event.choose chooser sourceEvent

Parameters:
    chooser : 'T -> 'U option - The function to select and transform event values to pass on.
    sourceEvent : IEvent<'Del, 'T> - The input event.

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

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.

chooser : 'T -> 'U option

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

sourceEvent : IEvent<'Del, 'T>

The input event.

Returns: IEvent<'U>

An event that fires only when the chooser returns Some.

Example

 open System

 let createTimer interval =
     let timer = new Timers.Timer(interval)
     timer.AutoReset <- true
     timer.Enabled <- true
     timer.Elapsed

 let timer = createTimer 1000

 let getEvenSeconds (number: Timers.ElapsedEventArgs) =
     match number with
     | _ when number.SignalTime.Second % 2 = 0 -> Some number.SignalTime
     | _ -> None

 let evenSecondsEvent = Event.choose getEvenSeconds timer

 evenSecondsEvent.Subscribe(fun x -> printfn $"{x} ")
 |> ignore

 Console.ReadLine() |> ignore
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ...
<summary>Generates an event after a set interval, with an option to generate recurring events.</summary>

--------------------
Timers.Timer() : Timers.Timer
Timers.Timer(interval: float) : Timers.Timer
Timers.Timer(interval: TimeSpan) : Timers.Timer
property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns>
property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>
<exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val getEvenSeconds: number: Timers.ElapsedEventArgs -> DateTime option
val number: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime
<summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>

--------------------
Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary>
<returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns>
property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary>
<returns>The seconds component, expressed as a value between 0 and 59.</returns>
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
val evenSecondsEvent: IEvent<DateTime>
Multiple items
module Event from Microsoft.FSharp.Control

--------------------
type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args>

--------------------
new: unit -> Event<'T>

--------------------
new: unit -> Event<'Delegate,'Args>
val choose: chooser: ('T -> 'U option) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'U> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<DateTime>) : IDisposable
val x: DateTime
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console = static member Beep: unit -> unit + 1 overload static member Clear: unit -> unit static member GetCursorPosition: unit -> struct (int * int) static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload static member OpenStandardError: unit -> Stream + 1 overload static member OpenStandardInput: unit -> Stream + 1 overload static member OpenStandardOutput: unit -> Stream + 1 overload static member Read: unit -> int static member ReadKey: unit -> ConsoleKeyInfo + 1 overload static member ReadLine: unit -> string ...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
The sample will output: 2/15/2022 12:04:04 AM 2/15/2022 12:04:06 AM 2/15/2022 12:04:08 AM

Event.filter predicate sourceEvent

Full Usage: Event.filter predicate sourceEvent

Parameters:
    predicate : 'T -> bool - The function to determine which triggers from the event to propagate.
    sourceEvent : IEvent<'Del, 'T> - The input event.

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

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.

predicate : 'T -> bool

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

sourceEvent : IEvent<'Del, 'T>

The input event.

Returns: IEvent<'T>

An event that only passes values that pass the predicate.

Example

 open System

 let createTimer interval =
     let timer = new Timers.Timer(interval)
     timer.AutoReset <- true
     timer.Enabled <- true
     timer.Elapsed

 let timer = createTimer 1000

 let getEvenSeconds (number: Timers.ElapsedEventArgs) =
     match number with
     | _ when number.SignalTime.Second % 2 = 0 -> true
     | _ -> false

 let evenSecondsEvent = Event.filter getEvenSeconds timer

 evenSecondsEvent.Subscribe(fun x -> printfn $"{x} ")
 |> ignore

 Console.ReadLine() |> ignore
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ...
<summary>Generates an event after a set interval, with an option to generate recurring events.</summary>

--------------------
Timers.Timer() : Timers.Timer
Timers.Timer(interval: float) : Timers.Timer
Timers.Timer(interval: TimeSpan) : Timers.Timer
property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns>
property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>
<exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val getEvenSeconds: number: Timers.ElapsedEventArgs -> bool
val number: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime
<summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>

--------------------
Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary>
<returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns>
property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary>
<returns>The seconds component, expressed as a value between 0 and 59.</returns>
val evenSecondsEvent: IEvent<Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control

--------------------
type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args>

--------------------
new: unit -> Event<'T>

--------------------
new: unit -> Event<'Delegate,'Args>
val filter: predicate: ('T -> bool) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'T> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<Timers.ElapsedEventArgs>) : IDisposable
val x: Timers.ElapsedEventArgs
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console = static member Beep: unit -> unit + 1 overload static member Clear: unit -> unit static member GetCursorPosition: unit -> struct (int * int) static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload static member OpenStandardError: unit -> Stream + 1 overload static member OpenStandardInput: unit -> Stream + 1 overload static member OpenStandardOutput: unit -> Stream + 1 overload static member Read: unit -> int static member ReadKey: unit -> ConsoleKeyInfo + 1 overload static member ReadLine: unit -> string ...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
The sample will only output even seconds: 2/15/2022 12:03:08 AM 2/15/2022 12:03:10 AM 2/15/2022 12:03:12 AM 2/15/2022 12:03:14 AM

Event.map mapping sourceEvent

Full Usage: Event.map mapping sourceEvent

Parameters:
    mapping : 'T -> 'U - The function to transform event values.
    sourceEvent : IEvent<'Del, 'T> - The input event.

Returns: IEvent<'U> An event that passes the transformed values.

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

mapping : 'T -> 'U

The function to transform event values.

sourceEvent : IEvent<'Del, 'T>

The input event.

Returns: IEvent<'U>

An event that passes the transformed values.

Example

 open System

 let createTimer interval =
     let timer = new Timers.Timer(interval)
     timer.AutoReset <- true
     timer.Enabled <- true
     timer.Elapsed

 let timer = createTimer 1000

 let transformSeconds (number: Timers.ElapsedEventArgs) =
     match number with
     | _ when number.SignalTime.Second % 2 = 0 -> 100
     | _ -> -500

 let evenSecondsEvent = Event.map transformSeconds timer

 evenSecondsEvent.Subscribe(fun x -> printf $"{x} ")
 |> ignore

 Console.ReadLine() |> ignore
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ...
<summary>Generates an event after a set interval, with an option to generate recurring events.</summary>

--------------------
Timers.Timer() : Timers.Timer
Timers.Timer(interval: float) : Timers.Timer
Timers.Timer(interval: TimeSpan) : Timers.Timer
property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns>
property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>
<exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val transformSeconds: number: Timers.ElapsedEventArgs -> int
val number: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime
<summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>

--------------------
Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary>
<returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns>
property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary>
<returns>The seconds component, expressed as a value between 0 and 59.</returns>
val evenSecondsEvent: IEvent<int>
Multiple items
module Event from Microsoft.FSharp.Control

--------------------
type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args>

--------------------
new: unit -> Event<'T>

--------------------
new: unit -> Event<'Delegate,'Args>
val map: mapping: ('T -> 'U) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'U> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<int>) : IDisposable
val x: int
val printf: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console = static member Beep: unit -> unit + 1 overload static member Clear: unit -> unit static member GetCursorPosition: unit -> struct (int * int) static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload static member OpenStandardError: unit -> Stream + 1 overload static member OpenStandardInput: unit -> Stream + 1 overload static member OpenStandardOutput: unit -> Stream + 1 overload static member Read: unit -> int static member ReadKey: unit -> ConsoleKeyInfo + 1 overload static member ReadLine: unit -> string ...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
The sample will transform the seconds if it's even or odd number and the output is: -500 100 -500 100 -500 100

Event.merge event1 event2

Full Usage: Event.merge event1 event2

Parameters:
    event1 : IEvent<'Del1, 'T> - The first input event.
    event2 : IEvent<'Del2, 'T> - The second input event.

Returns: IEvent<'T> An event that fires when either of the input events fire.

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

event1 : IEvent<'Del1, 'T>

The first input event.

event2 : IEvent<'Del2, 'T>

The second input event.

Returns: IEvent<'T>

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

Example

 open System.Reactive.Linq
 open System
 let createTimer interval =
     let timer = new Timers.Timer(interval)
     timer.AutoReset <- true
     timer.Enabled <- true
     timer.Elapsed

 let oneSecondTimer = createTimer 1000
 let fiveSecondsTimer = createTimer 5000

 let result = Event.merge oneSecondTimer fiveSecondsTimer

 result.Subscribe(fun output -> printfn $"Output - {output.SignalTime} ")
 |> ignore

 Console.ReadLine() |> ignore
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ...
<summary>Generates an event after a set interval, with an option to generate recurring events.</summary>

--------------------
Timers.Timer() : Timers.Timer
Timers.Timer(interval: float) : Timers.Timer
Timers.Timer(interval: TimeSpan) : Timers.Timer
property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns>
property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>
<exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val oneSecondTimer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val fiveSecondsTimer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val result: IEvent<Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control

--------------------
type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args>

--------------------
new: unit -> Event<'T>

--------------------
new: unit -> Event<'Delegate,'Args>
val merge: event1: IEvent<'Del1,'T> -> event2: IEvent<'Del2,'T> -> IEvent<'T> (requires delegate and 'Del1 :> Delegate and delegate and 'Del2 :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<Timers.ElapsedEventArgs>) : IDisposable
val output: Timers.ElapsedEventArgs
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary>
<returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns>
val ignore: value: 'T -> unit
type Console = static member Beep: unit -> unit + 1 overload static member Clear: unit -> unit static member GetCursorPosition: unit -> struct (int * int) static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload static member OpenStandardError: unit -> Stream + 1 overload static member OpenStandardInput: unit -> Stream + 1 overload static member OpenStandardOutput: unit -> Stream + 1 overload static member Read: unit -> int static member ReadKey: unit -> ConsoleKeyInfo + 1 overload static member ReadLine: unit -> string ...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
The sample will output: Output - 2/15/2022 12:10:40 AM Output - 2/15/2022 12:10:41 AM Output - 2/15/2022 12:10:41 AM Output - 2/15/2022 12:10:42 AM Output - 2/15/2022 12:10:43 AM

Event.pairwise sourceEvent

Full Usage: Event.pairwise sourceEvent

Parameters:
    sourceEvent : IEvent<'Del, 'T> - The input event.

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

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.

sourceEvent : IEvent<'Del, 'T>

The input event.

Returns: IEvent<'T * 'T>

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

Example

 open System

 let createTimer interval =
     let timer = new Timers.Timer(interval)
     timer.AutoReset <- true
     timer.Enabled <- true
     timer.Elapsed

 let timer = createTimer 1000

 let pairWise = Event.pairwise timer

 let extractPair (pair: Timers.ElapsedEventArgs * Timers.ElapsedEventArgs) =
     let leftPair, rightPair = pair
     printfn $"(Left): {leftPair.SignalTime} (Right): {rightPair.SignalTime}"

 pairWise.Subscribe(extractPair) |> ignore

 Console.ReadLine() |> ignore
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ...
<summary>Generates an event after a set interval, with an option to generate recurring events.</summary>

--------------------
Timers.Timer() : Timers.Timer
Timers.Timer(interval: float) : Timers.Timer
Timers.Timer(interval: TimeSpan) : Timers.Timer
property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns>
property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>
<exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val pairWise: IEvent<Timers.ElapsedEventArgs * Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control

--------------------
type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args>

--------------------
new: unit -> Event<'T>

--------------------
new: unit -> Event<'Delegate,'Args>
val pairwise: sourceEvent: IEvent<'Del,'T> -> IEvent<'T * 'T> (requires delegate and 'Del :> Delegate)
val extractPair: Timers.ElapsedEventArgs * Timers.ElapsedEventArgs -> unit
val pair: Timers.ElapsedEventArgs * Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime
<summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>

--------------------
Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs
val leftPair: Timers.ElapsedEventArgs
val rightPair: Timers.ElapsedEventArgs
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary>
<returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns>
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<Timers.ElapsedEventArgs * Timers.ElapsedEventArgs>) : IDisposable
val ignore: value: 'T -> unit
type Console = static member Beep: unit -> unit + 1 overload static member Clear: unit -> unit static member GetCursorPosition: unit -> struct (int * int) static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload static member OpenStandardError: unit -> Stream + 1 overload static member OpenStandardInput: unit -> Stream + 1 overload static member OpenStandardOutput: unit -> Stream + 1 overload static member Read: unit -> int static member ReadKey: unit -> ConsoleKeyInfo + 1 overload static member ReadLine: unit -> string ...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
The sample will output the timer event every second: (Left): 2/14/2022 11:58:46 PM (Right): 2/14/2022 11:58:46 PM (Left): 2/14/2022 11:58:46 PM (Right): 2/14/2022 11:58:47 PM (Left): 2/14/2022 11:58:47 PM (Right): 2/14/2022 11:58:48 PM

Event.partition predicate sourceEvent

Full Usage: Event.partition predicate sourceEvent

Parameters:
    predicate : 'T -> bool - The function to determine which output event to trigger.
    sourceEvent : IEvent<'Del, 'T> - The input event.

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.

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.

predicate : 'T -> bool

The function to determine which output event to trigger.

sourceEvent : IEvent<'Del, 'T>

The input event.

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.

Example

 open System

 let createTimer interval =
     let timer = new Timers.Timer(interval)
     timer.AutoReset <- true
     timer.Enabled <- true
     timer.Elapsed

 let timer = createTimer 1000

 let getEvenSeconds (number: Timers.ElapsedEventArgs) =
     match number with
     | _ when number.SignalTime.Second % 2 = 0 -> true
     | _ -> false

 let leftPartition, rightPartition = Event.partition getEvenSeconds timer

 leftPartition.Subscribe(fun x -> printfn $"Left partition: {x.SignalTime}")
 |> ignore

 rightPartition.Subscribe(fun x -> printfn $"Right partition: {x.SignalTime}")
 |> ignore

 Console.ReadLine() |> ignore
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ...
<summary>Generates an event after a set interval, with an option to generate recurring events.</summary>

--------------------
Timers.Timer() : Timers.Timer
Timers.Timer(interval: float) : Timers.Timer
Timers.Timer(interval: TimeSpan) : Timers.Timer
property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns>
property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>
<exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val getEvenSeconds: number: Timers.ElapsedEventArgs -> bool
val number: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime
<summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>

--------------------
Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary>
<returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns>
property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary>
<returns>The seconds component, expressed as a value between 0 and 59.</returns>
val leftPartition: IEvent<Timers.ElapsedEventArgs>
val rightPartition: IEvent<Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control

--------------------
type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args>

--------------------
new: unit -> Event<'T>

--------------------
new: unit -> Event<'Delegate,'Args>
val partition: predicate: ('T -> bool) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'T> * IEvent<'T> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<Timers.ElapsedEventArgs>) : IDisposable
val x: Timers.ElapsedEventArgs
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console = static member Beep: unit -> unit + 1 overload static member Clear: unit -> unit static member GetCursorPosition: unit -> struct (int * int) static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload static member OpenStandardError: unit -> Stream + 1 overload static member OpenStandardInput: unit -> Stream + 1 overload static member OpenStandardOutput: unit -> Stream + 1 overload static member Read: unit -> int static member ReadKey: unit -> ConsoleKeyInfo + 1 overload static member ReadLine: unit -> string ...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
The sample will partition into two events if it is even or odd seconds: Right partition: 2/15/2022 12:00:27 AM Left partition: 2/15/2022 12:00:28 AM Right partition: 2/15/2022 12:00:29 AM Left partition: 2/15/2022 12:00:30 AM Right partition: 2/15/2022 12:00:31 AM

Event.scan collector state sourceEvent

Full Usage: Event.scan collector state sourceEvent

Parameters:
    collector : 'U -> 'T -> 'U - The function to update the state with each event value.
    state : 'U - The initial state.
    sourceEvent : IEvent<'Del, 'T> - The input event.

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

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.

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

The function to update the state with each event value.

state : 'U

The initial state.

sourceEvent : IEvent<'Del, 'T>

The input event.

Returns: IEvent<'U>

An event that fires on the updated state values.

Example

 open System

 let createTimer interval =
     let timer = new Timers.Timer(interval)
     timer.AutoReset <- true
     timer.Enabled <- true
     timer.Elapsed

 let timer = createTimer 1000

 let multiplyBy number =
     fun (timerEvent: Timers.ElapsedEventArgs) -> number * timerEvent.SignalTime./// Second

 let initialState = 2

 let scan = Event.scan multiplyBy initialState timer

 scan.Subscribe(fun x -> printf "%A " x) |> ignore

 Console.ReadLine() |> ignore
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ...
<summary>Generates an event after a set interval, with an option to generate recurring events.</summary>

--------------------
Timers.Timer() : Timers.Timer
Timers.Timer(interval: float) : Timers.Timer
Timers.Timer(interval: TimeSpan) : Timers.Timer
property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns>
property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>
<exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val multiplyBy: number: int -> timerEvent: Timers.ElapsedEventArgs -> int
val number: int
val timerEvent: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime
<summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>

--------------------
Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary>
<returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns>
val initialState: int
val scan: IEvent<int>
Multiple items
module Event from Microsoft.FSharp.Control

--------------------
type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args>

--------------------
new: unit -> Event<'T>

--------------------
new: unit -> Event<'Delegate,'Args>
val scan: collector: ('U -> 'T -> 'U) -> state: 'U -> sourceEvent: IEvent<'Del,'T> -> IEvent<'U> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<int>) : IDisposable
val x: int
val printf: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console = static member Beep: unit -> unit + 1 overload static member Clear: unit -> unit static member GetCursorPosition: unit -> struct (int * int) static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload static member OpenStandardError: unit -> Stream + 1 overload static member OpenStandardInput: unit -> Stream + 1 overload static member OpenStandardOutput: unit -> Stream + 1 overload static member Read: unit -> int static member ReadKey: unit -> ConsoleKeyInfo + 1 overload static member ReadLine: unit -> string ...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
The sample will output depending on your timestamp. It will multiply the seconds with an initial state of 2: 106 5724 314820 17629920 1004905440 -1845026624 -1482388416

Event.split splitter sourceEvent

Full Usage: Event.split splitter sourceEvent

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

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.

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.

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

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

sourceEvent : IEvent<'Del, 'T>

The input event.

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.

Example

 open System

 let createTimer interval =
     let timer = new Timers.Timer(interval)
     timer.AutoReset <- true
     timer.Enabled <- true
     timer.Elapsed

 let timer = createTimer 1000

 let bySeconds (timerEvent: Timers.ElapsedEventArgs) =
     match timerEvent.SignalTime.Second % 2 = 0 with
     | true -> Choice1Of2 timerEvent.SignalTime.Second
     | false -> Choice2Of2 $"{timerEvent.SignalTime.Second} is not an even num ber"

 let evenSplit, printOddNumbers = Event.split bySeconds timer

 let printOutput event functionName =
     Event.add (fun output -> printfn $"{functionName} - Split output: {output}. /// Type: {output.GetType()}") event

 printOutput evenSplit (nameof evenSplit) |> ignore

 printOutput printOddNumbers (nameof printOddNumbers)
 |> ignore

 Console.ReadLine() |> ignore
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ...
<summary>Generates an event after a set interval, with an option to generate recurring events.</summary>

--------------------
Timers.Timer() : Timers.Timer
Timers.Timer(interval: float) : Timers.Timer
Timers.Timer(interval: TimeSpan) : Timers.Timer
property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns>
property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>
<exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception>
<returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val bySeconds: timerEvent: Timers.ElapsedEventArgs -> Choice<int,string>
val timerEvent: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime
<summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary>

--------------------
Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary>
<returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns>
property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary>
<returns>The seconds component, expressed as a value between 0 and 59.</returns>
union case Choice.Choice1Of2: 'T1 -> Choice<'T1,'T2>
union case Choice.Choice2Of2: 'T2 -> Choice<'T1,'T2>
val evenSplit: IEvent<int>
val printOddNumbers: IEvent<string>
Multiple items
module Event from Microsoft.FSharp.Control

--------------------
type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args>

--------------------
new: unit -> Event<'T>

--------------------
new: unit -> Event<'Delegate,'Args>
val split: splitter: ('T -> Choice<'U1,'U2>) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'U1> * IEvent<'U2> (requires delegate and 'Del :> Delegate)
val printOutput: event: IEvent<'a,'b> -> functionName: 'c -> unit (requires delegate and 'a :> Delegate)
val event: IEvent<'a,'b> (requires delegate and 'a :> Delegate)
val functionName: 'c
val add: callback: ('T -> unit) -> sourceEvent: IEvent<'Del,'T> -> unit (requires delegate and 'Del :> Delegate)
val output: 'b
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val nameof: 'T -> string
val ignore: value: 'T -> unit
type Console = static member Beep: unit -> unit + 1 overload static member Clear: unit -> unit static member GetCursorPosition: unit -> struct (int * int) static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload static member OpenStandardError: unit -> Stream + 1 overload static member OpenStandardInput: unit -> Stream + 1 overload static member OpenStandardOutput: unit -> Stream + 1 overload static member Read: unit -> int static member ReadKey: unit -> ConsoleKeyInfo + 1 overload static member ReadLine: unit -> string ...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
The sample will split the events by even or odd seconds: evenSplit - Split output: 44. Type: System.Int32 printOddNumbers - Split output: 45 is not an even number. Type: System.String evenSplit - Split output: 46. Type: System.Int32 printOddNumbers - Split output: 47 is not an even number. Type: System.String evenSplit - Split output: 48. Type: System.Int32 printOddNumbers - Split output: 49 is not an even number. Type: System.String

Type something to start searching.