WebView.LongRunningScriptDetected 事件

定義

WebView 執行 JavaScript 時定期發生,讓您停止腳本。

// Register
event_token LongRunningScriptDetected(TypedEventHandler<WebView, WebViewLongRunningScriptDetectedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
WebView::LongRunningScriptDetected_revoker LongRunningScriptDetected(auto_revoke_t, TypedEventHandler<WebView, WebViewLongRunningScriptDetectedEventArgs const&> const& handler) const;
public event TypedEventHandler<WebView,WebViewLongRunningScriptDetectedEventArgs> LongRunningScriptDetected;
function onLongRunningScriptDetected(eventArgs) { /* Your code */ }
webView.addEventListener("longrunningscriptdetected", onLongRunningScriptDetected);
webView.removeEventListener("longrunningscriptdetected", onLongRunningScriptDetected);
- or -
webView.onlongrunningscriptdetected = onLongRunningScriptDetected;
Public Custom Event LongRunningScriptDetected As TypedEventHandler(Of WebView, WebViewLongRunningScriptDetectedEventArgs) 
<WebView LongRunningScriptDetected="eventhandler"/>

事件類型

備註

指令碼正在執行時,您的應用程式看起來會像沒有回應。 此事件提供中斷長時間執行腳本的機會。 若要判斷腳本執行的時間長度,請檢查WebViewLongRunningScriptDetectedEventArgs物件的ExecutionTime屬性。 若要停止指令碼,請將事件引數 StopPageScriptExecution屬性設定為 true。 除非在後續 的 WebView 流覽期間重載已停止的腳本,否則不會再次執行。

注意

在某些情況下, WebView 無法偵測長時間執行的腳本。 例如,如果腳本卡在未執行任何記憶體配置的迴圈中,就可能不會發生此事件。

適用於

另請參閱