Contents

UnityWebApps

The QML component that binds to a QML WebView and exposes the Unity WebApps API to it's javascript. More...

Properties

Methods

Detailed Description

Examples:

UnityWebApps {
    id: webapps
    name: "MyApp"
    bindee: webView
}

On the page's javascript side, an event is being sent to the document when the API is exposed and ready to be used: "ubuntu-webapps-api-ready".

So a typical pattern for the page's javascript could be:

function init() {
    // The Unity APIs are available throuhg external.getUnityObject
    var Unity = external.getUnityObject(1);
}
if (!external.getUnityObject) {
    document.addEventListener ("ubuntu-webapps-api-ready", function () {
            init();
        });
}

Property Documentation

_opt_backendProxies : string

Used only for testing. Allows optional (not the default ones) mocked backends to be used.


actionsContext : UnityActions.Context

The actions context that this element can reach out to for additional actions.


bindee : string

Holds a reference to the object that webapps are to be injected in.

The UnityWebApps QML component expects any bindee to duck-type with the following IDL signature:

method getUnityWebappsProxies()

that should return a BindeeExports:

interface BindeeExports {
    method injectUserScripts(string userScriptUrls);
    method sendToPage(string message);
    method loadingStartedConnect(Callback onLoadingStarted);
    method messageReceivedConnect(Callback onMessageReceived);
    method navigateTo(string url);
}

model : UnityWebappsAppModel

An optional model used in conjunction with the 'name' property as a location for looking up the desired webapps.


name : string

Holds the name of the application that is run as a WebApp. It should be used in conjunction with a model. The 'name' property is then used while looking up for the webapp in the set of locally installed ones.

The name should not change once it has been set. (?)


Method Documentation

UnityWebApps::__createBackendsIfNeeded()


UnityWebApps::__initWebappForName( name)


UnityWebApps::__isValidWebAppName( name)


UnityWebApps::callOnInitScriptFunc()


UnityWebApps::getWrappedJsCallback( jscallback)


UnityWebApps::isValidInitCall( params)


UnityWebApps::onInitCompleted( success)