Titanium JIRA Archive
Alloy (ALOY)

[ALOY-357] Button fires event "singletap" twice

GitHub Issuen/a
TypeBug
PriorityCritical
StatusResolved
ResolutionFixed
Resolution Date2012-11-02T16:34:04.000+0000
Affected Version/sn/a
Fix Version/sAlloy 0.3.1, 2012 Sprint 22
Componentsn/a
Labelsalloy, button
ReporterMing Liu
AssigneeUnknown
Created2012-10-17T16:58:02.000+0000
Updated2018-03-07T22:25:45.000+0000

Description

Attachments

FileDateSize
singletap.tgz2012-10-17T18:20:39.000+000054281

Comments

  1. Ming Liu 2012-10-17

    sample code
  2. Ming Liu 2012-10-17

    Seems like changing .on to .addEventListener solves the problem
  3. Tony Lukasavage 2012-11-02

    This ended up being a pretty deep issue. The events firing twice were a symptom of a larger problem in the management of eventing done in order to wrap the Backbone eventing function for Titanium proxies. In short, the event listener only needs to be added to the proxy once, then its handling delegated to any number of handlers in the corresponding backbone listener(s). Listeners were being added to the proxy for _every_ new listener on a particular event added, which has been fixed. Same logic, except in reverse for the off() function as well. We only remove the event listener from the titanium proxy when there are no more listeners in the corresponding Backbone eventing.
  4. Tony Lukasavage 2012-11-02

    @Ming: for reference, on() will work as expected when this change is pushed in 0.3.1. No need to use addEventListener() if you don't want. Thanks for taking the time to log this one cause it was actually a very important catch.
  5. Ming Liu 2012-11-02

    @Tony Thanks for getting this fixed. Looking forward to 0.3.1
  6. Kabriel Robichaux 2012-11-02

    @Tony: Thanks for this fix! :)

JSON Source