(翻译)火狐操作系统javascript API

原文地址

开放网络应用(Open Web app)的JavaScript API是提供安装、客户端管理等功能的程序接口。

Feature availability

这些 JavaScript API目前还不可用。当前已经发布的版本在火狐15以后就过时了。

Mozilla已经实现了一个原型: "dashboard",可以到 myapps.mozillalabs.com 进行测试。

Methods of the API

所有和应用相关的方法都通过navigator.mozApps 对象来访问。有两种方法:

Installation API (navigator.mozApps.* )

该 installation API来自 window.navigator.mozApps 对象.

Management API (navigator.mozApps.mgmt.* )

该management API是特权API。它要授权访问信任页,也就是所谓的 "dashboards"。该 API的方法运行dashboards管理和运行应用。另外,也提供了账户同步方法。

Objects

下面的JavaScript对象由应用API使用:

Old API and the new API

若还在实验老的API, 在2012年3月会过期。 新旧对应如下:

navigator.mozApps.install()
This function has a changed signature.
navigator.mozApps.amInstalled() 过时
Replaced by navigator.mozApps.getSelf() .
navigator.mozApps.getInstalledBy() 过时  
Replaced by navigator.mozApps.getInstalled() .
navigator.mozApps.mgmt.list() 过时  
Replaced by navigator.mozApps.mgmt.getAll() .
navigator.mozApps.mgmt.watchUpdates(onupdate) 过时
navigator.mozApps.mgmt.clearWatch(watchId) 过时
Both of these replaced by navigator.mozApps.addEventListener(type, cb) and navigator.mozApps.removeEventListener(type, cb) where type can be either "install" or "uninstall".
navigator.mozApps.mgmt.uninstall(origin, [onsuccess], [onerror]) 过时
Replaced by app.uninstall() where app is an object returned by getAll() or getInstalled() .

猜你喜欢

转载自somefuture.iteye.com/blog/1729765