TimerHandler Struct

The handler of GlobalScope.SetTimeout and GlobalScope.SetInterval (https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timerhandler): a callback, or the source text of a script (a string or a TrustedScript), which only runs when the browsing context has a script engine.

public readonly struct TimerHandler : IEquatable<TimerHandler>
Implements

Properties

NameDescription
ValueGets the value: a FunctionCallback, an Action, a String or a TrustedScript.

Gets the value: a FunctionCallback, an Action, a String or a TrustedScript.

public object Value { get; }

Property value

object

Methods

NameDescription
Equals(TimerHandler)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
FromAction(Action)Creates a timer handler from a .NET delegate.
FromFunction(FunctionCallback)Creates a timer handler from a callback function.
FromString(string)Creates a timer handler from the source text of a script.
FromTrustedScript(TrustedScript)Creates a timer handler from a trusted script.
GetHashCode()Returns the hash code for this instance.
ToString()Returns the fully qualified type name of this instance.

Equals overloads

Equals(TimerHandler)

GlobalScope.Timers.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(TimerHandler other)
Parameters
other TimerHandler
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

GlobalScope.Timers.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

FromAction(Action)

GlobalScope.Timers.cs

Creates a timer handler from a .NET delegate.

public static TimerHandler FromAction(Action value)

Parameters

value Action

Returns

TimerHandler

FromFunction(FunctionCallback)

GlobalScope.Timers.cs

Creates a timer handler from a callback function.

public static TimerHandler FromFunction(FunctionCallback value)

Parameters

value FunctionCallback

Returns

TimerHandler

FromString(string)

GlobalScope.Timers.cs

Creates a timer handler from the source text of a script.

public static TimerHandler FromString(string value)

Parameters

value string

Returns

TimerHandler

FromTrustedScript(TrustedScript)

GlobalScope.Timers.cs

Creates a timer handler from a trusted script.

public static TimerHandler FromTrustedScript(TrustedScript value)

Parameters

value TrustedScript

Returns

TimerHandler

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

Returns the fully qualified type name of this instance.

public override string? ToString()

Returns

string? The fully qualified type name.

Operators

NameDescription
operator ==(TimerHandler, TimerHandler)Returns whether the two timer handlers hold equal values.
implicit operator TimerHandler(FunctionCallback)Converts a callback function to a timer handler.
implicit operator TimerHandler(TrustedScript)Converts a trusted script to a timer handler.
implicit operator TimerHandler(Action)Converts a .NET delegate to a timer handler.
implicit operator TimerHandler(string)Converts the source text of a script to a timer handler.
operator !=(TimerHandler, TimerHandler)Returns whether the two timer handlers hold different values.

operator ==(TimerHandler, TimerHandler)

GlobalScope.Timers.cs

Returns whether the two timer handlers hold equal values.

public static bool operator ==(TimerHandler left, TimerHandler right)

Parameters

left TimerHandler
right TimerHandler

Returns

bool

op_Implicit overloads

implicit operator TimerHandler(FunctionCallback)

GlobalScope.Timers.cs

Converts a callback function to a timer handler.

public static implicit operator TimerHandler(FunctionCallback value)
Parameters
value FunctionCallback
Returns

TimerHandler

implicit operator TimerHandler(TrustedScript)

GlobalScope.Timers.cs

Converts a trusted script to a timer handler.

public static implicit operator TimerHandler(TrustedScript value)
Parameters
value TrustedScript
Returns

TimerHandler

implicit operator TimerHandler(Action)

GlobalScope.Timers.cs

Converts a .NET delegate to a timer handler.

public static implicit operator TimerHandler(Action value)
Parameters
value Action
Returns

TimerHandler

implicit operator TimerHandler(string)

GlobalScope.Timers.cs

Converts the source text of a script to a timer handler.

public static implicit operator TimerHandler(string value)
Parameters
value string
Returns

TimerHandler

operator !=(TimerHandler, TimerHandler)

GlobalScope.Timers.cs

Returns whether the two timer handlers hold different values.

public static bool operator !=(TimerHandler left, TimerHandler right)

Parameters

left TimerHandler
right TimerHandler

Returns

bool