天天看點

(翻譯)火狐作業系統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()

過時  

navigator.mozApps.getInstalled()

navigator.mozApps.mgmt.list()

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])

app.uninstall()

where app is an object returned by

getAll()

or

getInstalled()

繼續閱讀