Examples of use cases for this API are:
The functionality in this API is.
This specification defines conformance criteria that apply to a single product: the user agent that implements the interfaces that it contains.
Implementations that use ECMAScript to implement the APIs defined in this specification MUST implement them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]], as this specification uses that specification and terminology.
The
EventHandler
interface represents a callback used for event handlers
as defined in [[!HTML5]].
The concepts queue a task and fire an event are defined in [[!HTML5]].
The terms event handler and event handler event types are defined in [[!HTML5]].
This API must be only exposed to trusted content.
Web Applications are represented by the Application interface.
install()
in
ApplicationRegistry.
error
event to
the DOMRequest object with the
"NotAllowedError"
error code and exit those steps.
success
event to the DOMRequest
object and set result
to null.error
event to
the DOMRequest object with an error code that
describes the error.
error
event to the DOMRequest
object with the "NotInstalledError"
error code and
exit those steps.
error
event to
the DOMRequest object with the
"NotAllowedError"
error code and exit those steps.
success
event to the
DOMRequest object and set result
to
null.error
event to
the DOMRequest object with an error code that
describes the error.
available
, downloading
,
downloaded
or installing
, depending on
the state of the application.installing
.downloaded
.downloading
.available
. Otherwise, the attribute MUST
return the empty string.
InvalidState
and abort these steps.
running
if the current
application state is running. Otherwise, if the current
application state is paused, it MUST return
paused
. Otherwise, it MUST return
terminated
.
The following are the event handlers (and their corresponding
event handler event types) that MUST be supported as
attributes by the Application
objects:
event handler | event handler event type |
---|---|
onlaunch
|
launch
|
onpause
|
pause
|
onresume
|
resume
|
onterminate
|
terminate
|
UserCancel
.
error
the attribute MUST
return 0.0. Otherwise, if the current state is
success
, the attribute MUST return 1.0. Otherwise,
the attribute SHOULD return the current progress of the download
expressed between 0.0 and 1.0.
When the caller start the download, the DownloadRequest SHOULD start downloading the resource.
If the resource fails to download, the UA MUST send an error
message to the request.
If the resource succeed to download, the UA MUST send a success message to the request.
While the resource is downloading, which means as long as
readyState
is pending
, the UA SHOULD
regularly fire a simple event named progress on the
object. The UA should note that sending too much events might have
an impact on performance but sending too few of them might impact
the user experience.
The following are the event handlers (and their
corresponding event handler event types) that MUST be
supported as attributes by the DOMRequest
objects:
event handler | event handler event type |
---|---|
onprogress
|
progress
|
An ApplicationRegistry instance is exposed on the
Navigator
object trough the an app
attribute.
The ApplicationRegistry interface allows handling applications and query there status.
error
event to
the DOMRequest object with the
"NotAllowedError"
error code and exit those steps.
manifestUrl
.
success
event to the DOMRequest
object and set result
to null.error
event to
the DOMRequest object with an error code that
describes the error.
The UA SHOULD verify at any moment before installing that
manifestUrl
points to a valid manifest. If this is
not the case, the UA MUST fire an error
event to
the DOMRequest object with the
"InvalidArgumentError"
and exit the steps.
The UA SHOULD save the parameters
if some are
passed so they can later be retrieved by the
parameters
attribute on the Application
interface.
success
event to the DOMRequest object and sets its
result
attribute to the Application object
representing the current context or null
if the
current context is not an application context.
success
event to the DOMRequest object and
populate its result
attribute with an array of
Application objects representing the applications.
success
event to the DOMRequest object and
populate its result
attribute with the boolean value
true if there is an installed application fulfilling the
condition, otherwise result
should be set to false.
The ApplicationManagement interface allows access to all applications and is being informed any time an application is being installed or uninstalled. The intent of this interface is to be restricted to privileged callers.
The getAll
method SHOULD return a DOMRequest
object and asynchronously get all installed applications.
When those applications are collected, the UA SHOULD send a
success
event to the DOMRequest object and
populate its request
attribute with an array of
Application objects representing the applications.
The applyUpdate
method MUST return a DOMRequest
object and perform the following steps asynchronously:
InvalidState
and abort these
steps.
An install event using the ApplicationEvent interface
MUST be fired on all ApplicationManagement instances as soon
as an application is installed with the application
attribute set to the Application object representing the
installed application.
The uninstall event using the ApplicationEvent
interface MUST be fired on all ApplicationManagement
instances as soon as an application is uninstalled with the
application
attribute set to the Application
object representing the uninstalled application.
The following are the event handlers (and their
corresponding event handler event types) that MUST be
supported as attributes by the ApplicationManagement
object:
event handler | event handler event type |
---|---|
oninstall
|
install
|
onuninstall
|
uninstall
|
Application Events are sent when an event happen on the application level like an application being installed or uninstalled.
ApplicationEvent objects MUST contain a non-null
application
attribute representing the application on
each the action happened.
The application events are always sent asynchronously, do not bubble
and are not cancelable.
There are currently two types of Application Events:
application
MUST represent the installed application.
application
MUST represent the uninstalled
application.
TBD.