CoreWebView2Settings.PreferredForegroundTimerWakeInterval Property

Definition

The preferred timer wake up interval (in milliseconds) to use for timer tasks in script (setTimeout and setInterval), when the WebView is in foreground state.

public TimeSpan PreferredForegroundTimerWakeInterval { get; set; }
member this.PreferredForegroundTimerWakeInterval : TimeSpan with get, set
Public Property PreferredForegroundTimerWakeInterval As TimeSpan

Property Value

Remarks

A WebView is in foreground state when its IsVisible property is TRUE. This aligns to the Chromium concept of foreground, which means programmatically visible, even if occluded. For more details, see Page Visibility API.

A wake up interval is the amount of time that needs to pass before the WebView2 Runtime checks for new timer tasks to run.

The WebView2 Runtime will try to respect the preferred interval set by the application, but the effective value will be constrained by resource and platform limitations. Setting a value of 0 means a preference of 0 ms between timer wake ups. The default value is a constant determined by the running version of the WebView2 Runtime. Setting the value of this property will take effect immediately.

For example, an application might use a foreground value of 30 ms for moderate throttling scenarios. In this case, timers will run at most every 30 ms. Or the application could get and match the default background value (usually 1000 ms).

Applies to