[
https://issues.apache.org/jira/browse/CB-9426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14645480#comment-14645480
]
ASF GitHub Bot commented on CB-9426:
------------------------------------
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.
----
> Exception using device motion plugin on browser platform
> --------------------------------------------------------
>
> Key: CB-9426
> URL: https://issues.apache.org/jira/browse/CB-9426
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Device Motion
> Reporter: Tim Barham
> Assignee: Tim Barham
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> When you use the {{device motion}} plugin on the browser platform, you get
> the following exception:
> {{module cordova-plugin-device-motion.accelerometer already defined}}
> This is because the {{accelerometer}} module name is used twice in plugin.xml.
> Note that exactly the same problem exists for the {{device orientation}}
> plugin.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]