Commit cff07782 authored by Emanuele Aina's avatar Emanuele Aina

web-runtime: Split the Platform APIs section from LibBredon

Promote the considerations about how native platform APIs are
exported to JavaScript in their own section, so they can be referenced
more easily.
Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
Differential Revision: https://phabricator.apertis.org/D4832
parent a2a52537
......@@ -326,6 +326,38 @@ Cached files are stored in the per-application, per-user cache directory,
as specified by the *Data Storage* section of the [Applications design document],
and as pointed to by the `$XDG_CACHE_HOME` environment variable.
### Platform APIs
Access to the native APIs provided by the platform
to JavaScript code running in the web view context
is granted through GObject-Introspection.
The JavaScript code running in the web view can access such APIs
through the global `imports` (or `window.imports`) object
exporting the GObject-Introspection bindings
from the `imports.gi` attribute,
as defined in the WebIDL below:
```
[NoInterfaceObject] interface ApertisImportsObject {
readonly attribute ApertisImports imports;
};
Window implements ApertisImportsObject;
[NoInterfaceObject] interface GObjectIntrospection {
};
[NoInterfaceObject] interface ApertisImports {
readonly attribute GObjectIntrospection gi;
};
```
The `GObjectIntrospection` interface will then export
the GObject-Introspection modules whitelisted by the application
(for example `imports.gi.Folks`).
### Hardkey integration
The web runtime should handle the `back` hardkey
......@@ -385,30 +417,8 @@ and adds UI theming support.
A loadable web extension module is provided by LibBredon,
making SDK API bindings available to the page's JS context
and providing a global JavaScript object `imports` (or `window.imports`)
exporting the GObject-Introspection bindings
from the `imports.gi` attribute,
as defined in the WebIDL below:
```
[NoInterfaceObject] interface ApertisImportsObject {
readonly attribute ApertisImports imports;
};
Window implements ApertisImportsObject;
[NoInterfaceObject] interface GObjectIntrospection {
};
[NoInterfaceObject] interface ApertisImports {
readonly attribute GObjectIntrospection gi;
};
```
The `GObjectIntrospection` interface will then export
the GObject-Introspection modules whitelisted by the application
(for example `imports.gi.Folks`).
and providing the global JavaScript object described
in the [Platform APIs] section.
A `GApplication` subclass will provide the main entry point
for both the shared launcher and hybrid applications,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment