WebView.connectLoadChanged

Connect to LoadChanged signal.

Emitted when a load operation in web_view changes. The signal is always emitted with webkit.types.LoadEvent.Started when a new load request is made and webkit.types.LoadEvent.Finished when the load finishes successfully or due to an error. When the ongoing load operation fails #WebKitWebView::load-failed signal is emitted before #WebKitWebView::load-changed is emitted with webkit.types.LoadEvent.Finished. If a redirection is received from the server, this signal is emitted with webkit.types.LoadEvent.Redirected after the initial emission with webkit.types.LoadEvent.Started and before webkit.types.LoadEvent.Committed. When the page content starts arriving the signal is emitted with webkit.types.LoadEvent.Committed event.

You can handle this signal and use a switch to track any ongoing load operation.

static void web_view_load_changed (WebKitWebView  *web_view,
                                   WebKitLoadEvent load_event,
                                   gpointer        user_data)
{
    switch (load_event) {
    case WEBKIT_LOAD_STARTED:
        // New load, we have now a provisional URI
        provisional_uri = webkit_web_view_get_uri (web_view);
        // Here we could start a spinner or update the
        // location bar with the provisional URI
        break;
    case WEBKIT_LOAD_REDIRECTED:
        redirected_uri = webkit_web_view_get_uri (web_view);
        break;
    case WEBKIT_LOAD_COMMITTED:
        // The load is being performed. Current URI is
        // the final one and it won't change unless a new
        // load is requested or a navigation within the
        // same page is performed
        uri = webkit_web_view_get_uri (web_view);
        break;
    case WEBKIT_LOAD_FINISHED:
        // Load finished, we can now stop the spinner
        break;
    }
}
class WebView
ulong
connectLoadChanged
(
T
)
(,
Flag!"After" after = No.After
)
if (
isCallable!T &&
is(ReturnType!T == void)
&&
(
Parameters!T.length < 1 ||
(
ParameterStorageClassTuple!T[0] == ParameterStorageClass.none &&
is(Parameters!T[0] == webkit.types.LoadEvent)
)
)
&&
(
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

void callback(webkit.types.LoadEvent loadEvent, webkit.web_view.WebView webView)

loadEvent the #WebKitLoadEvent (optional)

webView the instance the signal is connected to (optional)

after Flag!"After"

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

Return Value

Type: ulong

Signal ID