Firefox vs Chrome App APIs How do the API’s compare ?
When porting a chrome packaged app to a firefox packaged app you will need to do an inventory as to which chrome specific api’s you are using and create a level of abstraction around them, as the naming / capabilities of the apis vary across the platforms.
I will try to break this article into information on which apis are supported across both platforms, where you can find docs, and lastly which apis have no commonality across both platforms (Firefox or Chrome).
Web APIs in Common:
The Web APIs that share commonality in function between the two platforms, are listed below:
alarm, getUserMedia(audio), Bluetooth, Device Storage API, navigator.id API, Idle API, Geolocation API, Web Notifications, Permissions API, Battery Status API, Simple Push API, TCP Socket API, Pointer Lock API, Power Management API, ContextMenus
List of Chrome’s HTML5 apis: http://developer.chrome.com/apps/api_other.html
The difficulty for the developer will be in writing an app that can handle both browsers elegantly. This is already done in many cases with the use of W3C compliant API’s such as geolocation data.(navigator.geolocation, which is also supported under google chrome, just not listed as such in their packaged apps documentation (ack), and soon to be battery status. But for the majority the function calls are different as well as the data being returned.
The other part of the discussion could revolve around which Firefox OS API’s are not yet implemented in Chrome OS. How close are all the APIs to standardization ?
Chrome OS similarly has a set of APIs which are not implemented in Firefox OS:
app.window = a concept not supported in firefox, generally gives the ability to maximize, minimize, change window size..etc
app.runtime = a concept not supported in firefox, basically used to notify when the app has been restarted
i18n = internationalization API.
serial= An API that allows you to read contents of the serial port.
runtime = API to retrieve the background page, return details about the manifest, and listen for and respond to events in the app or extension lifecycle.
tts: Text To Speech API
usb: An API that allows you to access USB based devices
The APIs that I would personally like to see implemented are around internationalization, serial, usb. I believe if there are to be different types of devices / targets out there it will be helpful for end devices to be able to read / write to serial /usb. This could enable a suite of new types of devices / functionality we don’t really expect.
I think HTML5 definitely needs to think about how to support background processes, I am unsure what mechanism that may be in the future.
The take away from this article would be to experiment / deploy as you write your apps, and definitely make sure you have a level of abstraction around APIs that are not standardized through the W3C, as they may change, and your app will likely have to change as a result.