> 2) No yield, until new ecmascript 6, but some links
 
Something like facebook/regenerator would run that on stable 0.10 quite happily.
 
 
11.05.2014, 18:54, "Angel Java Lopez" <[email protected]>:
Hi!
 
You again ;-) ;-) (after Scala, Clojure.. )
 
1) No goroutinges, but streams and events (stream2 is the "new" implementation, two years age). But maybe _javascript_ generators? I'm not sure.
 
2) No yield, until new ecmascript 6, but some links
(v 0.11 not the stable 0.10.x)
 
3) setImmediate(myfn); or setTimeout(myfn, 0) (later is preferred, if your library should run in browsers too; not all the browsers implements setImmediate)
 
4) It's really simple. A complex number arithmetic library
The key part is the package.json file where you define the entry point, the dependencies, the scripts to run (what is "npm test"?), the dev dependencies. You can get an account on NPM, and publish your module
 
Sometimes, your main module.js is splitted, like in
but you can still tests the files 
 
notice the use of .npmignore to not publish samples files
 
Sometimes, your separated files should be arranged in one, to support browsers
 
It could be rearrange with automation commands in only one to be used in browser. In the above project, I did the work with a windows command, and using the trick of defining each submodule in a function
 
mysubmodule = (function() { 
...
   return ....
}
 
if (typeof module != 'undefined' && module.exports)
    module.exports = mysubmodule;
 
and concatenating all the files in order
 
But you can use browserfy by @substack 
 
Sure, there are more complete and better samples
 
You can read a lot of good code and module use/patterns at
 
Angel "Java" Lopez
@ajlopez
 
 


On Sun, May 11, 2014 at 9:21 AM, Massimiliano Tomassoli <[email protected]> wrote:
Hi everyone,
I'd like to port a Dart library to node.js (https://github.com/mtomassoli/golib) but I don't know much about node.js.
I have some questions:
  1. Do you already have goroutines and channels in node.js?
  2. Can I use yield?
  3. How can I add a function to the event loop? (I'll need to emulate Dart's completers)
  4. What's the structure of a node.js library/module? Any links?

Thanks.

 

 

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/fa584a27-76b5-49e8-a4b8-6ac86bdaaa95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAMs%2BDqK9LZ0O31gZFDeX5SrYQ2%2Bi1iTOmT9YAN5Zgx253Gdx1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/551271399933029%40web6j.yandex.ru.
For more options, visit https://groups.google.com/d/optout.

Reply via email to