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

Modularize? #8

Closed
tomek-he-him opened this issue Apr 11, 2015 · 5 comments
Closed

Modularize? #8

tomek-he-him opened this issue Apr 11, 2015 · 5 comments

Comments

@tomek-he-him
Copy link

λ aims to be modular and browser-friendly. How about releasing every function as a separate script? This goes right in hand with “Methods are implemented individually and not as part of a whole.”

Here’s why: when you just want one or two λ functions, you still have to pull the whole source of contra into your bundle:

var concurrent = require("contra").concurrent;

3 kB minified code isn’t much – but it matters when you write a browser-facing app or library. It would be much better if you could just get the 300 bytes you really need:

var concurrent = require("contra/concurrent");

Here’s how: tjmehta/101 is a great example of such an approach.

You can also keep full backwards compatibility with the current syntax – var concurrent = require("contra").concurrent – by supplying an index.js like this one. This index.js could then also be compiled into a drop-in bundle for browsers. Just as it is now.

@bevacqua
Copy link
Owner

I did this for contra.emitter, which is typically all I need client-side. I don't have the time to do it, but it's definitely a welcome pull request

@tomek-he-him
Copy link
Author

:) funny, I've actually filed this issue because I needed to import contra/emitter. Anyway, I'll do my best to submit a PR next week – though I'm also quite tied up at the moment.

@bevacqua bevacqua closed this as completed Jun 2, 2015
@bevacqua
Copy link
Owner

bevacqua commented Jul 2, 2015

I went ahead and did this myself for 1.9.0

@tomek-he-him
Copy link
Author

Thank you. Sorry for not letting you know – I realized that I just needed the pubsub part, and that I needed more power. So I went ahead and wrote another library: stereo. It’s like λ/emitter, but split down further into many tiny modules.

@bevacqua
Copy link
Owner

bevacqua commented Jul 3, 2015

No worries, I kinda needed it anyways :)

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

2 participants