GitHub user TimBarham opened a pull request:
https://github.com/apache/cordova-plugin-device-orientation/pull/21
CB-9426 Fix exception using device orientation plugin on browser platform
Initially reported for the `device motion` plugin, the same problem exists
for the `device orientation` plugin.
The plugin's `plugin.xml` defines a general `<js-module>` with the name
`compass`. It defines another `<js-module>` for the `browser` platform (that
merges with the general module) with the same name. Modules with the same name
are not allowed, so Cordova throws an exception at runtime when trying to
define the browser version of the module.
Since the only difference in the browser version of the module is to fake
up `deviceorientation` events, I've deleted the browser version and added that
logic to the general module, with the following change: rather than starting a
new event timer every time `watchHeading()` is called (which could happen
multiple times resulting in multiple superfluous timers), we have a single
event timer going as long as there are active watchers.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/MSOpenTech/cordova-plugin-device-orientation
CB-9426
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-plugin-device-orientation/pull/21.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #21
----
commit eb976dc650d954c721967e2a26808f1cd15635c5
Author: Tim Barham <[email protected]>
Date: 2015-07-29T05:40:06Z
CB-9426 Fix exception when using device orientation plugin on browser
platform.
The plugin's plugin.xml defines a general <js-module> with the name
'compass'. It defines another <js-module> for the browser platform (that merges
with the general module) with the same name. Modules with the same name is not
allowed, so Cordova throws an exception at runtime when trying to define the
browser version of the module.
Since the only difference in the browser version of the module is to fake
up deviceorientation events, I've deleted the browser version and added that
logic to the general module, with the following change: rather than starting a
new event timer everytime watchHeading() is called (which could happen multiple
times resulting in multiple superfluous timers), we have a single event timer
going as long as there are active watchers.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]