Dela via


IWebViewControl.LongRunningScriptDetected Event

Definition

Occurs periodically while the IWebViewControl executes JavaScript, letting you halt the script.

// Register
event_token LongRunningScriptDetected(TypedEventHandler<IWebViewControl, WebViewControlLongRunningScriptDetectedEventArgs const&> const& handler) const;

// Revoke with event_token
void LongRunningScriptDetected(event_token const* cookie) const;

// Revoke with event_revoker
IWebViewControl::LongRunningScriptDetected_revoker LongRunningScriptDetected(auto_revoke_t, TypedEventHandler<IWebViewControl, WebViewControlLongRunningScriptDetectedEventArgs const&> const& handler) const;
event TypedEventHandler<IWebViewControl,WebViewControlLongRunningScriptDetectedEventArgs> LongRunningScriptDetected;
function onLongRunningScriptDetected(eventArgs) { /* Your code */ }
iWebViewControl.addEventListener("longrunningscriptdetected", onLongRunningScriptDetected);
iWebViewControl.removeEventListener("longrunningscriptdetected", onLongRunningScriptDetected);
- or -
iWebViewControl.onlongrunningscriptdetected = onLongRunningScriptDetected;
Event LongRunningScriptDetected As TypedEventHandler(Of IWebViewControl, WebViewControlLongRunningScriptDetectedEventArgs) 

Event Type

Remarks

Your app might appear unresponsive while scripts are running. This event provides an opportunity to interrupt a long-running script. To determine how long the script has been running, check the ExecutionTime property of the WebViewLongRunningScriptDetectedEventArgs object. To halt the script, set the event args StopPageScriptExecution property to true. The halted script will not execute again unless it is reloaded during a subsequent IWebViewControl navigation.

Note

In some cases, the IWebVieControl cannot detect a long-running script. For example, this event might not occur if the script is stuck in a loop that doesn’t perform any memory allocations.

Applies to