Titanium JIRA Archive
Alloy (ALOY)

[ALOY-809] Debugger stops because of an exception when adding event listeners in the view

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2013-10-29T22:24:28.000+0000
Affected Version/sAlloy 1.2.1
Fix Version/s2013 Sprint 22
ComponentsRuntime, Titanium Studio
Labelsn/a
ReporterDavide Cassenti
AssigneeTony Lukasavage
Created2013-08-29T08:23:08.000+0000
Updated2013-10-29T22:24:28.000+0000

Description

Description of the problem

Due to a recent chance in the way event listeners in the view are added (using try/catch instead of the ternary operator), the debugger is now suspending the flow when the app starts, because of the handled exception.

Steps to reproduce

1) Create new Alloy project 2) open index.xml and replace "doClick" with "exports.doClick" 3) open index.js and replace "function doClick(e)" with "exports.doCLick = function(e)" 4) Run the app The resulting file will contain:
try {
        $.__views.label.addEventListener("click", exports.doClick);
} catch ( e ) {
        __defers["$.__views.label!click!exports.doClick"] = true;
}
Previously, this was handled using a ternary operator, thus avoiding the try/catch.

Comments

  1. Tony Lukasavage 2013-10-24

    The try/catch method was implemented in order to allow arbitrary namespacing and JS in general to be used for identifying event handlers from markup. It resolved issues that were a problem with the prior method, resolved in ALOY-665. It is also noted that the user found a workaround for their particular situation. Finally, you can disable the behavior where Studio stops on exceptions by changing the setting like this: * Open Studio * Go to "Preferences -> Studio -> Javascript Debug" * Uncheck the "suspend" options until the desired behavior is met. Given the above, I'm going to close this ticket.

JSON Source