WebView.connectScriptDialog

Connect to ScriptDialog signal.

Emitted when JavaScript code calls <function>window.alert</function>, <function>window.confirm</function> or <function>window.prompt</function>, or when <function>onbeforeunload</function> event is fired. The dialog parameter should be used to build the dialog. If the signal is not handled a different dialog will be built and shown depending on the dialog type: <itemizedlist> <listitem><para> webkit.types.ScriptDialogType.Alert: message dialog with a single Close button. </para></listitem> <listitem><para> webkit.types.ScriptDialogType.Confirm: message dialog with OK and Cancel buttons. </para></listitem> <listitem><para> webkit.types.ScriptDialogType.Prompt: message dialog with OK and Cancel buttons and a text entry with the default text. </para></listitem> <listitem><para> webkit.types.ScriptDialogType.BeforeUnloadConfirm: message dialog with Stay and Leave buttons. </para></listitem> </itemizedlist>

It is possible to handle the script dialog request asynchronously, by simply caling webkit.script_dialog.ScriptDialog.ref_ on the dialog argument and calling webkit.script_dialog.ScriptDialog.close when done. If the last reference is removed on a #WebKitScriptDialog and the dialog has not been closed, webkit.script_dialog.ScriptDialog.close will be called.

class WebView
ulong
connectScriptDialog
(
T
)
(,
Flag!"After" after = No.After
)
if (
isCallable!T &&
is(ReturnType!T == bool)
&&
(
Parameters!T.length < 1 ||
(
ParameterStorageClassTuple!T[0] == ParameterStorageClass.none &&
)
)
&&
(
Parameters!T.length < 2 ||
(
ParameterStorageClassTuple!T[1] == ParameterStorageClass.none &&
is(Parameters!T[1] : webkit.web_view.WebView)
)
)
&&
Parameters!T.length < 3
)

Parameters

callback T

signal callback delegate or function to connect

bool callback(webkit.script_dialog.ScriptDialog dialog, webkit.web_view.WebView webView)

dialog the #WebKitScriptDialog to show (optional)

webView the instance the signal is connected to (optional)

Returns true to stop other handlers from being invoked for the event. false to propagate the event further.

after Flag!"After"

Yes.After to execute callback after default handler, No.After to execute before (default)

Return Value

Type: ulong

Signal ID