cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Grieve <agri...@google.com>
Subject JS Symbols
Date Wed, 06 Feb 2013 16:33:37 GMT
Some of our APIs are meant to be polyfills, and some of them are not.

It's great to expose the polyfill-type ones using the standards-based
symbols. E.g. FileEntry, requestFileSystem.

For the custom ones though, I think it's important for devs to realize that
the APIs they are using are custom to Cordova, and will never work in other
browsers.

Examples:
Camera: window.Camera
InAppBrowser: window.open()
globalization: navigator.globalization

There's been some talk about deprecating the window.plugins namespace. But
why? I think it would be clearer if these apis were:
Camera: plugins.camera
InAppBrowser: plugins.inappbrowser.open
globalization: plugins.globalization

This makes it much more clear that the APIs are not browser-based ones, but
Cordova-specific.

If the rational to get rid of the plugins is to save on a global symbol,
how about using cordova as the namespace?

cordova.camera.getPicture()
cordova.inappbrowser.open()
corodva.globalization.getLocale()

aka:
cordova.$PLUGIN_NAME.exports

Thoughts?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message