PDA

View Full Version : [FIXED] [PR2] Ext.application broken ?



olouvignes
11 Nov 2011, 5:04 AM
This basic code is not working anymore with PR2 on my computer, nothing on the console. Any ideas why ?


Ext.application({
name: 'Sencha',
launch: function() {
alert('launched');
}
});

Jamie Avins
11 Nov 2011, 8:49 AM
We'll check into it. Thank you for the report.

rdougan
11 Nov 2011, 10:07 AM
Which Sencha Touch js file are you using? I've tested sencha-touch-all.js and sencha-touch-all-debug.js and they both work fine with this code.

cristiano.meda
12 Nov 2011, 2:54 AM
I have the same problem...

olouvignes
13 Nov 2011, 12:27 PM
ST2.0PR1 clearly conflicts with phonegap somehow.
Tried phonegap-1.1.0.js & phonegap-1.2.0.js -> crashes (with no error on both).
Works well when phonegap is not embedded in the webpage.

robl
13 Nov 2011, 4:45 PM
Is this related to the bug report I filed regarding the alternate class name for Ext.application? I am using PhoneGap 1.2.0 and my app is broken too. I'm debugging it now to figure out what happened...

http://www.sencha.com/forum/showthread.php?154714-PR2-Ext.Application-alternate-class-name-conflict

olouvignes
13 Nov 2011, 4:55 PM
It seems that Phonegap can't fire "deviceready" event that PR2 requires for starting up. Quite strange.
A quick fix can be to replace l.8846 (debug-w-comments) from :

if (Ext.browser.is.PhoneGap) {
to :

if (false && Ext.browser.is.PhoneGap) {

We need sth smarter though...

robl
13 Nov 2011, 5:12 PM
PhoneGap 1.2.0 seems to fire that just fine. Do you use something like this:


Ext.setup({
viewport: {
autoMaximize: false
},
onReady: function() {
console.log("onReady:");
var app = new Ext.app.Application({
name: 'MyApp',
autoCreateViewport: false,
launch: function() {
console.log('launch:');
}
});


}
});


It seems that Phonegap can't fire "deviceready" event that PR2 requires for starting up. Quite strange.
A quick fix can be to replace l.8846 (debug-w-comments) from :

if (Ext.browser.is.PhoneGap) {
to :

if (false && Ext.browser.is.PhoneGap) {

We need sth smarter though...

olouvignes
13 Nov 2011, 5:14 PM
Nope sth like :



Ext.application({


name: 'MyApp',
controllers: [],


autoCreateViewport: true,
viewport: {
autoMaximize: false
},


init: function() {
d&&console.log(this.name + '.application#init', [this, arguments]);
},


launch: function() {
this.launched = true;
this.mainLaunch();
},


mainLaunch: function() {
d&&console.log(this.name + '.application#mainLaunch', [this, arguments]);
if ((Ext.os.deviceType == 'Phone' && !device) || !this.launched) {return;}
}


});


Always had "Ext.setup already launched" when wrapped in Ext.setup... Worked well so far.

rdougan
17 Nov 2011, 11:23 AM
I'm running the following code with Phone Gap 1.2.0 with no problems:


Ext.application({
name: 'Sencha',
launch: function() {
alert('launched');
}
});

I've tested on the simulator on both iOS 4.3 and 5, and iOS 5 on device.

Please ensure you have included PhoneGap before you include ST:


<!DOCTYPE HTML>
<html lang="en-US">
<head>
<base href="http://rob.local/test/phonegap/" />
<meta charset="UTF-8">
<title>PhoneGap Test</title>

<!-- Include PhoneGap first -->
<script type="text/javascript" charset="utf-8" src="phonegap-1.2.0.js"></script>

<!-- Include Sencha Touch -->
<script type="text/javascript" src="../../../touch/sencha-touch.js"></script>

<!-- Include the application -->
<script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>

olouvignes
17 Nov 2011, 11:52 AM
It is indeed included before.
However it only happens when debugging app on desktop (chrome mac latest stable). It is working in the simulator.
When i include both phonegap & then sencha-pr2, deviceready event is never fired... Can't explain why.