Hello Francesco, > On Nov 12, 2014, at 8:45 PM, Francesco Iovine <[email protected]> wrote: > > The question is: > > - how do I create a javascript "navigator.getBattery()" interface?
You'll need to play with Navigator.webidl [1] for this. I recommend you to take a quick look to the WebIDL documentation [2] and you can check [3] for an example of how to add a function to the navigator object, specifically [4] and [5] patches. I am not sure if there´s currently a better way to do this though, maybe something like NavigatorProperty [6] but for functions. Cheers, / Fernando [1] https://mxr.mozilla.org/mozilla-central/source/dom/webidl/Navigator.webidl <https://mxr.mozilla.org/mozilla-central/source/dom/webidl/Navigator.webidl> [2] https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings <https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings> [3] https://bugzilla.mozilla.org/show_bug.cgi?id=988469 [4] https://hg.mozilla.org/mozilla-central/rev/ffa3043bd8eb [5] https://hg.mozilla.org/mozilla-central/rev/52bbad182cb3 <https://hg.mozilla.org/mozilla-central/rev/52bbad182cb3> [6] https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#NavigatorProperty
_______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
