cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Clelland <iclell...@chromium.org>
Subject Re: What's the rule when determine where to attach plugin object/method to window or navigator object?
Date Mon, 14 Oct 2013 02:11:59 GMT
I can't speak officially for any of the early decisions made in the
project, but the guiding principles seem to be:

1. If possible, adhere to an existing W3C standard
(File, Storage)
2. If there is a de facto standard implemented on desktop browsers,use that
(Accelerometer, Geolocation)
3. If there is a natural mapping to a closely related desktop API, then
mimic that. (e.g, window.open -> InAppBrowser)
4. Other plugins were generally attached to navigator (navigator.compass,
navigator.globalization, navigator.splashscreen), except for
5. A couple of APIs (e.g., Device, Media) which were assigned to window.

Custom namespaces are really just objects attached to the global window
object; that's how Media and File are defined. (In the browser, all lookups
eventually go back to window; that's just where globals live.)

Ian



On Sat, Oct 12, 2013 at 4:55 AM, Qi LUO <luoq@polyvi.com> wrote:

> Hi all,
>
> Everyone can access plugins at window or navigator object, but I’m quite
> curious that how you guys make the decision when you define a plugin? Why
> someone is on the window object but another is on the navigator object or
> any custom namespace else?
> Thanks.
>
> Best Regards,
>
> Qi LUO
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>
>

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