[AC-1599] Some parts of initialization code are not executed in Alloy project
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Invalid |
Resolution Date | 2014-05-15T18:48:00.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Fix Please |
Assignee | Tony Lukasavage |
Created | 2014-05-14T19:22:48.000+0000 |
Updated | 2016-03-08T07:38:04.000+0000 |
Description
alert('Hello 1');
(function (){
alert('Hello 2');
})();
alert('Hello 3');
(function (){
alert('Hello 4');
})();
alert('Hello 5');
In Classic project all the messages are shown in opposite order:
'Hello 5', 'Hello 4', 'Hello 3', 'Hello 2', 'Hello 1'.
In Alloy project the same code shows the last message ('Hello 5') *only*.
Below is one more test case. The same as before, the 'Classic' project shows all the messages but *in strange order*: 'Hello 5', 'Hello 4', 'Hello 3', 'Hello 2', 'Hello 1'. Alloy project shows the last message ('Hello 5') *only*. *Take a look, please.*
Where do you have this code? In a controller, lib or alloy.js? And what does the compiled code looks like?
{quote} Where do you have this code? In a controller, lib or alloy.js? {quote} I've just created a new test Alloy project from the scratch in order to re-check the issue once again.
Case 1.
*index.js* is empty. *alloy.js* is as follows:The result:
Hello from alloy.js 5 Hello from alloy.js 4 Hello from alloy.js 3 Hello from alloy.js 2 Hello from alloy.js 1Case 2.
*alloy.js* is empty. *index.js* is as follows:The result:
Hello from index.js 5 Hello from index.js 4 Hello from index.js 3 Hello from index.js 2 Hello from index.js 1Case 3.
*alloy.js* is empty. *index.js* is as follows (note, $.index.open() is added this time):The result:
Hello from index.js 5Case 4.
*alloy.js* is as follows:*index.js* is as follows:
The result:
Hello from index.js 5The comparison here was poorly defined. The behavior between classic titanium and alloy is the same. Notice in your example everything works as expected until you add
$.index.open()
. If you create an equivalent classic titanium example, which augments your test case in the following way:The classic example behaves in the exact same way as alloy, showing only the last alert of
alert('Hello 5')
. This is behavior in Android that kills the pending alerts because a new activity is being opened when you open the main windows, which iswin
in the classic case,$.index
in the alloy case. There is no disparity between alloy and titanium.Additional note: if it is important to you that you be able to queue large amounts of alert() calls even when a new Android activity is opened, you could request that this be reopened and moved to the TIMOB project, as it has nothing to do with Alloy. TBH though, I would imagine this might not get much love since it is an extremely impractical use case. Entirely up to you whether to pursue though, if you can make a case for it.
{quote} you could request that this be reopened and moved to the TIMOB project {quote} No, thanks.