Interface WebView.UserMessageReceivedCallback

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.

@FunctionalInterface public static interface WebView.UserMessageReceivedCallback extends FunctionPointer

Functional interface declaration of the UserMessageReceivedCallback callback.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    run(@Nullable UserMessage message)
    This signal is emitted when a WebKitUserMessage is received from the WebKitWebPage corresponding to webView. You can reply to the message using webkit_user_message_send_reply().
    Creates a native function pointer to the upcall(MemorySegment, MemorySegment) method.
    default int
    upcall(MemorySegment sourceWebView, MemorySegment message)
    The upcall method is called from native code.
  • Method Details

    • run

      boolean run(@Nullable UserMessage message)

      This signal is emitted when a WebKitUserMessage is received from the WebKitWebPage corresponding to webView. You can reply to the message using webkit_user_message_send_reply().

      You can handle the user message asynchronously by calling g_object_ref() on message and returning true. If the last reference of message is removed and the message has not been replied to, the operation in the WebKitWebPage will finish with error UserMessageError.USER_MESSAGE_UNHANDLED_MESSAGE.

      Since:
      2.28
    • upcall

      default int upcall(MemorySegment sourceWebView, MemorySegment message)
      The upcall method is called from native code. The parameters are marshaled and run(UserMessage) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, MemorySegment) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer