Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19450] Event handlers are assigned to the wrong event when removing and re-adding

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 4.1.0
Fix Version/sn/a
ComponentsAndroid, iOS
LabelsTCSupportTriage, core, defect
ReporterAdrian Holmes
AssigneeUnknown
Created2014-10-03T14:54:01.000+0000
Updated2018-02-28T19:55:08.000+0000

Description

The project consists of a single Alloy controller which creates a WebView which in turn loads index.html. The project was too big to include so please download from... https://dl.dropboxusercontent.com/u/5641333/EventingError.7z There are 2 distinct sides to the app namely the local js file which is loaded by index.html and the Alloy controller, index.js. For ease I will refer to these as web-side and app-side. On the web-side I've created a process which creates 10 eventListeners and then fires an event which is picked up on the app-side. The app-side responds by firing the previously added events. On the web-side the eventListeners respond to the events by sequentially logging one to ten to the console. Finally when the last event (ten) is fired the eventListeners are removed. So in simple terms we create the listeners, fire the associated events and then remove the listeners. When first running the sequence one to ten is printed to the console as expected however, subsequent runs call the events out of order suggesting the event handler is somehow assigned to the wrong event when it has previously removed. To reproduce please run the attached project, click run and see one to ten printed to the console. When the events have been removed (logged in the console) click run again, you'll see events one to ten fire in the correct order on the app-side but on the web-side they do not, worse still all the event handlers do not fire.

Comments

  1. Adrian Holmes 2014-11-06

    Hi Guys, Do you have any feedback on this? I ask because we're 2 to 3 weeks away from launching the app and I was wondering if you'd have a solution or if we should look to find an alternative approach. Thanks

JSON Source