共用方式為


IWebViewControl.LongRunningScriptDetected 事件

定義

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

// 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) 

事件類型

備註

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

注意

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

適用於