Titanium JIRA Archive
Alloy (ALOY)

[ALOY-971] Alloy : Collection events triggered with trigger() method are firing twice

GitHub Issuen/a
ResolutionWon't Fix
Resolution Date2015-01-14T22:06:31.000+0000
Affected Version/sAlloy 1.3.1
Fix Version/sn/a
ReporterNoah Lively
AssigneeTony Lukasavage


Using TI SDK GA 3.2.2 and iPhone Simulator... I've bound a listener to "my event" on Alloy.Collections.instance('TestModel2'). When I call trigger('my event') once on the collection singleton the listener is fired twice. See attached project file. Just build and run in the iPhone simulator to see the issue duplicated. You should see an alert fired twice when you click "Hello World"




  1. Noah Lively 2014-03-19

    Looks like backbone splits my event on the space and considers "my" end "event" two separate events... When I change to "my_event" it works the way I wanted it to. I'm used to Titanium.Api.fireEvent() and Titanium.Api.addEventListener() accepting event names with spaces. Perhaps it should be added to the Alloy docs that backbone splits events on space.
  2. Tim Poulsen 2014-03-21

    As stated on http://docs.appcelerator.com/backbone/0.9.2/#Events-on "The event string may also be a space-delimited list of several events..." So you're right that Backbone (which underlies Alloy models/collections) is treating your "my event" as two events. Honestly, until seeing this ticket, it never occurred to me to name events with spaces. I'm surprised to learn that it actually works with Titanium events (in both Classic and Alloy styles). We'll investigate to see if this is something we can support without breaking existing apps that use space-delimited events currently.

JSON Source