• UnityWebApps
  • Contents

    UnityWebApps

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

    Import Statement: import Ubuntu.UnityWebApps .

    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_clientApiFileUrl : string

    Used only for testing. Allows optional (not the default ones) client api to be used instead of the default one.


    _opt_homepage : string

    Used only for testing. Allows an optional a homepage to be specified when running a local http server.


    actionsContext : var

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


    bindee : var

    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);
    }

    customBackendProxies : var

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


    customClientApiFileUrl : string

    Used only for testing. Allows optional (not the default ones) client api to be used instead of the default one.


    injectExtraContentShareCapabilities : bool


    injectExtraUbuntuApis : bool


    model : var

    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. (?)


    requiresInit : bool


    Method Documentation

    PassthroughPolicy()


    RestrictedPolicy( restrictions)


    _onCompleted( data, onResourceUploadedCallback)


    callOnInitScriptFunc()


    getWrappedJsCallback( jscallback)


    isValidInitCall( params)


    onCreated()


    onInitCompleted( success)