Interface WebView.ScriptDialogCallback
- All Superinterfaces:
FunctionPointer
- Enclosing class:
WebView
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface declaration of the ScriptDialogCallback callback.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanrun(@Nullable ScriptDialog dialog) Emitted when JavaScript code callswindow.alert ,window.confirm orwindow.prompt , or whenonbeforeunload event is fired.default MemorySegmenttoCallback(Arena arena) Creates a native function pointer to theupcall(MemorySegment, MemorySegment)method.default intupcall(MemorySegment sourceWebView, MemorySegment dialog) Theupcallmethod is called from native code.
-
Method Details
-
run
Emitted when JavaScript code calls
window.alert ,window.confirm orwindow.prompt , or whenonbeforeunload event is fired. Thedialogparameter 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:ScriptDialogType.ALERT: message dialog with a single Close button.ScriptDialogType.CONFIRM: message dialog with OK and Cancel buttons.ScriptDialogType.PROMPT: message dialog with OK and Cancel buttons and a text entry with the default text.ScriptDialogType.BEFORE_UNLOAD_CONFIRM: message dialog with Stay and Leave buttons.It is possible to handle the script dialog request asynchronously, by simply caling webkit_script_dialog_ref() on the
dialogargument and calling webkit_script_dialog_close() when done. If the last reference is removed on aWebKitScriptDialogand the dialog has not been closed, webkit_script_dialog_close() will be called. -
upcall
Theupcallmethod is called from native code. The parameters are marshaled andrun(ScriptDialog)is executed. -
toCallback
Creates a native function pointer to theupcall(MemorySegment, MemorySegment)method.- Specified by:
toCallbackin interfaceFunctionPointer- Parameters:
arena- the arena in which the function pointer is allocated- Returns:
- the native function pointer
-