evothings and AMD

Discuss the company and its products.
thegecko
Posts: 6
Joined: 14:51, 24 Feb 2015

evothings and AMD

Postby thegecko » 09:41, 25 Aug 2015

Has anyone successfully got the evothings library and cordova working in an AMD-based structure, such as requirejs?

I'd be interested in how this works or if there is a recommended approach.

My tests have shown there are race issues loading the cordova library making it unavailable once all dependencies are require'd.

Cheers

psvensson
Posts: 5
Joined: 14:17, 31 Jul 2015

Re: evothings and AMD

Postby psvensson » 10:56, 25 Aug 2015

Hi @thegecko, there's no apparent reason why AMD couldn't be used to load both cordova and Evothings specific libraries.

Could you tell us more about your test setup? Do you load cordova directly, or do you shim it in AMD, do you let AMD/requireJS load each module dependency dynamically or are you using a build system? A link to the project would be great - if possible ^_^

Cheers,
PS

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: evothings and AMD

Postby micke » 11:16, 25 Aug 2015

We did a "home-grown" async script loading system for the libraries used by the Evothings example apps. (See file evothings.js - https://github.com/evothings/evothings- ... othings.js)

However, this system does not use modules, still just one global address space as with script tags.

Would be much nicer with something like require.js, we looked into it, but at the time it was a too big step to implement in all examples.

We have been discussing Ionic lately, do they use any kind of async module definition? They are based on Cordova and use Angular, perhaps they have figured it out?

Lets continue looking into this.

Best, Mikael

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: evothings and AMD

Postby micke » 11:41, 25 Aug 2015

Peter just told me Ionic/Angular don't have async module support.
Best, Mikael

thegecko
Posts: 6
Joined: 14:51, 24 Feb 2015

Re: evothings and AMD

Postby thegecko » 12:54, 25 Aug 2015

@psvensson I tried both cordova shimming and globals and saw race conditions or deviceready timeouts with both.
Ideally I'd prefer to go all in and shim cordova, but the most stable test was keeping it global.

I just wondered if someone had got this working in a reliable manner.

@micke with so many frameworks out there, going all in on one may be a dangerous approach. At least with AMD support hte developer should be able to pick and choose their frameworks :)

Cheers!

psvensson
Posts: 5
Joined: 14:17, 31 Jul 2015

Re: evothings and AMD

Postby psvensson » 12:23, 26 Aug 2015

HI again! Creating a Evothings example using RequireJS/AMD is probably not we will do near-term, since we're quite busy creating the next version of Evo.

I did find an article describing known issues with Cordova and AMD; https://www.nothing.ch/en/research/usin ... n-phonegap

It looks like avoiding dynamic loading (which you'd do in a release/build step anyway) is key to avoiding problems.

HTH,

Cheers.
PS

thegecko
Posts: 6
Joined: 14:51, 24 Feb 2015

Re: evothings and AMD

Postby thegecko » 18:56, 26 Aug 2015

thanks!


Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 7 guests