DOMApplication
In the Open Web apps JavaScript API, an App
object is a JavaScript object that represents an app that is or could be installed in the user's app repository.
Properties
Name | Description | Type |
---|---|---|
manifest |
The currently stored instance of the manifest of the app. | object |
manifestURL |
Where the manifest was found. | string |
origin |
The origin of the app (protocol, host, and optional port number). For example: http://example.com | string |
installOrigin |
The origin of the site that triggered the installation of the app. | string |
installTime |
The time that the app was installed. This is generated using Date().getTime() , represented as the number of milliseconds since midnight of January 1st, 1970. |
integer |
receipts |
An object containing an array of one or more receipts. Each receipt is a string. If there are no receipts, this is null . |
object or null |
state |
The enabled state of the current application. | enabled or disabled |
Methods
Method | Description |
---|---|
addReceipt() |
Adds a receipt to the app after an in-app purchase has been made. |
launch() |
Launches the application. Does not return any value. |
checkForUpdate() |
Check to see if the app has been updated. Returns a For packaged apps: check for updates and mark it as downloadavailable if needed. For hosted apps: check for updates on app manifest and application cache and update it if needed. |
removeReceipt() |
Removes a receipt from the app after an in-app purchase has been cancelled. |
replaceReceipt() |
Replaces one receipt with another. |
Example App object
JavaScript
Copy Code
{ manifest: { name: "Add-on Builder", default_locale: "en", installs_allowed_from: [ "https://apps-preview-dev.example.com/", "https://apps-preview.example.com/" ], description: "Add-on Builder makes it easy to write, build and test Firefox extensions using common web technologies.", version: "0.9.16.1", developer: { url: "https://builder.addons.mozilla.org/", name: "Mozilla Flightdeck Team" } }, origin: "https://builder-addons-dev.example.com", installTime: 1321986882773, installOrigin: "https://apps-preview-dev.example.com", receipts: ["h0dHBzOi8v (most of receipt removed here) Tg2ODtkUp"] }
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/domapplication