[ALOY-596] Function is being called twice When adding alternate Window platform="android" on view.xml
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Duplicate |
Resolution Date | 2014-05-01T20:25:17.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | alloy |
Reporter | Mardo Del Cid |
Assignee | Tim Poulsen |
Created | 2013-03-31T20:03:14.000+0000 |
Updated | 2014-05-01T20:25:17.000+0000 |
Description
app/controllers/home.js: ////////////////////////////////////////// var openBrowserOverlay; openBrowserOverlay = function() { alert("Clicked!"); }; ////////////////////////////////////////// app/views/home.xml: //////////////////////////////////////////Comments
- Tony Lukasavage 2013-04-02 It looks like on android you'll have 2 windows/buttons right on top of each other, and the buttons will both have the id "addButton". This would likely account for the alert being called twice. I'm going to close this for now and will re-open if more details are provided.
- Mardo Del Cid 2013-04-02
Hello Tony,
I'm testing on the iOS Simulator, not on Android.
Also, i would like to remark that works OK when using the standard way to define a function:
But it's called twice when defining the function as a variable:function openBrowserOverlay() { alert("Clicked!"); };
To easily replicate the issue, create a new alloy app and change *index.js* to:var openBrowserOverlay; openBrowserOverlay = function() { alert("Clicked!"); };
*index.xml* to:var doClick = function(e) { alert($.label.text); } $.index.open();
// Note that i added *platform="ios"* to the first Window And run it with iOS Simulator: titanium build -p ios P.S. Thanks for the great framework!<Alloy> <Window class="container" platform="ios"> <Label id="label" onClick="doClick">Hello, World</Label> </Window> <Window id="self" platform="android"> <Label id="label" onClick="doClick">Hello, World</Label> </Window> </Alloy>
- Tim Poulsen 2014-02-26 This appears to be resolved by the fix for ALOY-691.
- Tim Poulsen 2014-05-01 Tested and confirmed that this is no longer an issue thanks to the changes made in ALOY-691.