Android PhoneGap and RequireJS

閲覧: 915 回
最初の未読メッセージにスキップ

Aaron

未読、
2012/03/26 15:57:062012/03/26
To: phonegap
Hello,

I'm trying to get RequireJS (v1.0.7) to work with PhoneGap
(v1.5.0), but am running into a predicament using Android. For some
reason, the Android version of cordova.js (cordova-1.5.0.js)
implements it's own require and define methods. This makes it unable
to be used along side with RequireJS and probably other AMD loaders.
I've tried multiple attempts at trying to get them to work together
(inluding renaming cordova's "require" and "define" methods) with no
such luck. Is it possible to get a patch for the Android version to
fix this? I'm not asking for phonegap to be AMD compatible, just not
over-write the standard "require" and "define" methods. I've had no
problems with the IOS version and have yet to try the windows version.

Original RequireJS google group post:
http://groups.google.com/group/requirejs/browse_thread/thread/282a85c5eeed613f/e37063b882a9ff15?lnk=gst&q=phonegap#e37063b882a9ff15

TLDR: PhoneGap has implemented non standard "require" and "define"
methods in the Android version of PhoneGap ("cordova-1.5.0.js") making
it unable to be used with AMD loaders such as RequireJS.

Piotr Walczyszyn

未読、
2012/03/27 6:30:472012/03/27
To: phonegap
I also run into the same problem and I had to revert back my android
project to 1.4.1 version.
I followed recommendation from RequireJS discussion list to initialize
Cordova after RequireJS and to do conditional require,define overrides
but unfortunately the implementation that comes with Cordova is not
compatible with RequireJS.

p.

On Mar 26, 9:57 pm, Aaron <bigred...@gmail.com> wrote:
> Hello,
>
>      I'm trying to getRequireJS(v1.0.7) to work with PhoneGap
> (v1.5.0), but am running into a predicament using Android.  For some
> reason, the Android version of cordova.js (cordova-1.5.0.js)
> implements it's own require and define methods.  This makes it unable
> to be used along side withRequireJSand probably other AMD loaders.
> I've tried multiple attempts at trying to get them to work together
> (inluding renaming cordova's "require" and "define" methods) with no
> such luck.  Is it possible to get a patch for the Android version to
> fix this?  I'm not asking for phonegap to be AMD compatible, just not
> over-write the standard "require" and "define" methods.  I've had no
> problems with the IOS version and have yet to try the windows version.
>
> OriginalRequireJSgoogle group post:http://groups.google.com/group/requirejs/browse_thread/thread/282a85c...

Dewang Shah

未読、
2012/04/10 9:56:192012/04/10
To: phon...@googlegroups.com
Hi Piotr,

Does PhoneGap 1.4.1 work for you? I am using 1.5.0 with a patch from the main branch of 1.6.0 to make sure there is no conflict with the require/depend methods. It all works fine when I try it in a browser and on the Android simulator but when I try to load exactly the same code on an actual phone I get a timeout error from Require.js. I have tried setting the timeout to 30 seconds but it still fails.

Any ideas?

Thanks

Dewang Shah

未読、
2012/04/10 10:19:392012/04/10
To: phon...@googlegroups.com
Sorted. Looks like it was a problem with a Require plugin I was using to load PhoneGap as an AMD module. Changed that to just wrap it myself and it works!
全員に返信
投稿者に返信
転送
メッセージは削除されました
新着メール 0 件