Reputation: 4737
AFAIK meteorjs uses node-fibers, but their github page states that it is server side & v8 only (or is it not ?).
How does meteorjs implement nonblocking, synchronous like api on the client side?
Is it compatible with other browsers than chrome?
I would be very grateful if someone could point me to pure JS implementation of fibers, or explain how do they work (do they have own event loop?).
Any link to a github project of working client side fibers implementation will be also appreciated!
It's XMAS after all :)
Upvotes: 6
Views: 2000
Reputation: 1491
JavaScript is single threaded. If you wanted to implement non-blocking I/O, you would have to implement a node-style message loop and an asynchronous I/O library. By default, all client side I/O is synchronous, though Meteor and other libraries have provisions for callbacks.
Yes, Meteor's client-side implementation runs across multiple browsers besides Chrome.
Upvotes: 2
Reputation: 4118
I believe on the server side, everything is purely synchronous with Meteor, thanks to MiniMongo. Thus no asynchronous callback is needed, or to be more precise, Meteor doesn't need to wait for the update
callback from the server to go on to the next instruction, thanks to MiniMongo which responds synchronously.
I haven't verified everything I have just said by looking into the source code, but I can't imagine how it could work differently.
EDIT
Still haven't dived into the source code yet, but this section of the Meteor's guide seems to head the way I thought.
Upvotes: 0
Reputation: 21
Try JSCEX (Windjs)
Wind.js is an advanced library which enable us to control flow with plain JavaScript for asynchronous programming (and more) without additional pre-compiling steps.
It worked for both server side AND client side.
Upvotes: 0
Reputation: 413682
The node-fibers project is a Windows-only server-side extension to Node.js, implemented in C++. You may never ever see it available in a web browser.
Upvotes: 3