Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17828] Declare constants for event name strings

GitHub Issuen/a
TypeImprovement
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.4.0
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterChris Bowley
AssigneeUnknown
Created2014-10-08T13:19:20.000+0000
Updated2018-02-28T20:03:37.000+0000

Description

Using strings for event names is prone to typos which cause silent failures. Declaring constants, much like we have for style enumerations, would resolve this problem. e.g.
$.myButton.addEventListener('cilck', function(e){
    // nothing happens but its not obvious why
});
Could be replaced with:
$.myButton.addEventListener(Titanium.UI.Button.CLICK, function(e){
    // ...
});

Comments

No comments

JSON Source