[ 
https://issues.apache.org/jira/browse/CB-9426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14735877#comment-14735877
 ] 

ASF subversion and git services commented on CB-9426:
-----------------------------------------------------

Commit 8f1ad44eec7ca768257faae92b1b447bf9b02dbb in 
cordova-plugin-device-motion's branch refs/heads/master from [~TimBarham]
[ 
https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-device-motion.git;h=8f1ad44
 ]

CB-9426 Fix exception when using device motion plugin on browser platform.

The plugin's plugin.xml defines a general <js-module> with the name 
'accelerometer'. 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 
devicemotion 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 watchAcceleration() 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]

Reply via email to