Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node style requires #3

Closed
euforic opened this issue Sep 26, 2012 · 6 comments
Closed

Node style requires #3

euforic opened this issue Sep 26, 2012 · 6 comments

Comments

@euforic
Copy link

euforic commented Sep 26, 2012

Fix require to function similar to node js encapsulating seperate scripts in thier own context similar to titanium. Pull request may follow if my cappy obj-c skills permit. Thanks for the awesome opensource !

@tj
Copy link

tj commented Nov 29, 2012

+99999 commonjs is the way to go for sure if this hasn't been implemented yet, we could re-use all 400+ github.com/component and many node modules

@phoboslab
Copy link
Owner

Well, providing a CommonJS style require() function wouldn't magically make all NodeJS modules work. Ejecta is still missing all of Node's other APIs.

I kept this issue around, because I wanted to see demand for it, but my thought is, that you use Ejecta to make things, that were written for the Browser, work on iOS devices. And Browsers don't have CommonJS support either.

A NodeJS implementation on iOS is a nice idea too, but quite a different endeavor.

@tj
Copy link

tj commented Nov 29, 2012

it's easy to make browsers support commonjs, that's what component is, all of those that are not dom-related would work just fine with ejecta. The current way we develop js is hindered by browsers and their lack of modularity but nothing will fix that, only user-land can fix this, and that's what component is doing

@phoboslab
Copy link
Owner

Oh, I'm sorry. I assumed all those modules were nodejs specific.

I still think the current behaviour of ejecta.require() is useful and I want to keep it. So if we support a global commonJS style require() function, I'd probably want to rename the current ejecta.require() to avoid confusion. ejecta.include() or ejecta.import() maybe? Thoughts?

@tj
Copy link

tj commented Nov 30, 2012

include sounds good to me :D

@phoboslab
Copy link
Owner

Just added the CommonJS style require() function. ejecta.require() is now ejecta.include(): 7edd66a

I tested a few example modules with and it seemed to work fine. Please let me know if there's anything missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants