iwa domain

set_ready

Stories addressed

  • The IWA has finished loading its core code and is declaring to the native app that it is ready to handle window.communicate events.

URL

liquidstate://iwa/set_ready?request=URLENCODED_REQUEST_OBJECT

Request data

None

Response

No response

Stories addressed

  • Navigate from an IWA to another IWA, with a route specified

  • Navigate to a different route in the same IWA

  • Navigate from a native view to an IWA

  • Optionally: change tab before navigation (ignored for linear apps)

URL

liquidstate://iwa/navigate?request=URLENCODED_REQUEST_OBJECT

Request data

Example request data

{
    "webapp_id": "login",
    "entrypoint": "default",
    "route": "/",
    "replace": true,
    "latest": true,
}

Response

No response. Second web app will get window.communicate call with purpose = navigate.

Stories addressed

  • Navigate from a route back to another route on the navigation stack, with a route id specified

  • Navigate from a route back to the previous route

URL

liquidstate://iwa/navigate_back?request=URLENCODED_REQUEST_OBJECT

Request data

A route must match both webapp_id and route_id to be navigated to.

Example request data

{
    "webapp_id": "myapp",
    "route_id": "home"
}

Response

No response. When displaying the mathcing route again, the native app will send the original navigate event to the IWA, with all its data, for example:

window.communicate({
    "purpose": "navigate",
    "route": "/",
    "params": {
        "querystringparam1": "value"
    },
    "context": {
        "product_id": "com.example.app123.doc1",
        "page_slug": "page-1"
    }
})

trigger_action

Stories addressed

  • An action defined by a web app is triggered within the native UI (presumably toolbar or navabar button was tapped)

  • The current IWA wants to initiate a workflow which typically starts with an action

URL

liquidstate://iwa/navigate?request=URLENCODED_REQUEST_OBJECT

Request data

Example request data

{
    "id": "edit",
    "params": {
        "edit-mode": "advanced"
    }
}

Response data

Example response

window.communicate({
    "purpose": "response",
    "request_id": "UUID",
    "event_type": "trigger_action",
    "response_data": {
        "id": "edit",
        "params": {
            "edit-mode": "advanced"
        }
    }
})

Trigger action event initiated by the native app

Most of the time, actions are not triggered by the IWA but by the user tapping/clicking on a button which was presented to them within the native UI according to the IWA’s definition.

In this case there is no request/response flow but simply a window.communicate(...) event from the native to the IWA, with its purpose set to trigger_action.

Comm event data

Similar to the response_data above but at the root of the event object.

Example comm event

window.communicate({
    "purpose": "trigger_action",
    "id": "edit",
    "params": {
        "edit-mode": "advanced"
    }
})

handle_share (deprecated)

Note

handle_share events are deprecated in favour of the upcoming Service IWA feature

Stories addressed

  • The native app had information shared with it by the OS or another app and passes it on to its default IWA.

  • This not a request/response event, so its data sits at the root of the event object.

Comm event

Comm event data

File object properties:

Example comm event

window.communicate({
    "purpose": "handle_share",
    "source": "com.example.otherapp",
    "files": [
        {
            "path": "file:///path/to/local/file.png",
            "mime_type": "image/png"
        }
    ],
    "info": {
        "datetime": "2017-08-02 13:42:57"
    }
})

Last updated