gi-webkit2-4.0.14: WebKit2 bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.WebKit2.Objects.UserContentManager

Contents

Description

 

Synopsis

Exported types

Methods

addScript

userContentManagerAddScript Source #

Arguments

:: (HasCallStack, MonadIO m, IsUserContentManager a) 
=> a

manager: A UserContentManager

-> UserScript

script: A UserScript

-> m () 

Adds a UserScript to the given UserContentManager. The same UserScript can be reused with multiple UserContentManager instances.

Since: 2.6

addStyleSheet

userContentManagerAddStyleSheet Source #

Arguments

:: (HasCallStack, MonadIO m, IsUserContentManager a) 
=> a

manager: A UserContentManager

-> UserStyleSheet

stylesheet: A UserStyleSheet

-> m () 

Adds a UserStyleSheet to the given UserContentManager. The same UserStyleSheet can be reused with multiple UserContentManager instances.

Since: 2.6

new

userContentManagerNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m UserContentManager

Returns: A UserContentManager

Creates a new user content manager.

Since: 2.6

registerScriptMessageHandler

userContentManagerRegisterScriptMessageHandler Source #

Arguments

:: (HasCallStack, MonadIO m, IsUserContentManager a) 
=> a

manager: A UserContentManager

-> Text

name: Name of the script message channel

-> m Bool

Returns: True if message handler was registered successfully, or False otherwise.

Registers a new user script message handler. After it is registered, scripts can use window.webkit.messageHandlers.<name>.postMessage(value) to send messages. Those messages are received by connecting handlers to the UserContentManager::script-message-received signal. The handler name is used as the detail of the signal. To avoid race conditions between registering the handler name, and starting to receive the signals, it is recommended to connect to the signal *before* registering the handler name:

<informalexample><programlisting> WebKitWebView *view = webkit_web_view_new (); WebKitUserContentManager *manager = webkit_web_view_get_user_content_manager (); g_signal_connect (manager, "script-message-received::foobar", G_CALLBACK (handle_script_message), NULL); webkit_user_content_manager_register_script_message_handler (manager, "foobar"); </programlisting></informalexample>

Registering a script message handler will fail if the requested name has been already registered before.

Since: 2.8

removeAllScripts

userContentManagerRemoveAllScripts Source #

Arguments

:: (HasCallStack, MonadIO m, IsUserContentManager a) 
=> a

manager: A UserContentManager

-> m () 

Removes all user scripts from the given UserContentManager

Since: 2.6

removeAllStyleSheets

userContentManagerRemoveAllStyleSheets Source #

Arguments

:: (HasCallStack, MonadIO m, IsUserContentManager a) 
=> a

manager: A UserContentManager

-> m () 

Removes all user style sheets from the given UserContentManager.

Since: 2.6

unregisterScriptMessageHandler

userContentManagerUnregisterScriptMessageHandler Source #

Arguments

:: (HasCallStack, MonadIO m, IsUserContentManager a) 
=> a

manager: A UserContentManager

-> Text

name: Name of the script message channel

-> m () 

Unregisters a previously registered message handler.

Note that this does *not* disconnect handlers for the UserContentManager::script-message-received signal, they will be kept connected, but the signal will not be emitted unless the handler name is registered again.

See also userContentManagerRegisterScriptMessageHandler

Since: 2.8

Signals

scriptMessageReceived