2

I know python and databases very well. But I want to improve my limited JavaScript knowledge.

For my toy project I want to use an async queue in the web browser.

In python there is a nice library which I used with multiprocessing: https://docs.python.org/2/library/queue.html

Now I search something like this, but it needs to run in the browser.

async-queue-js

Step 1: The in-queue pulls work-items (pink circles). Just a view json bytes.

Step 2: The User processes the data.

Step 3: The out-queue cares for sending the result to the server.

Why this "complicated" setup? Because I want the application to be as responsive as possible. The in-queue should pre-load some data and the out-queue should handle response communication.

An other benefit is, that with this setup the application can handle server or network outage for a period of some minutes.

Which JS libraries could be used? I prefer to re-use an existing library.

3
+50

What you are asking for is nowadays known in the JS world as two way data binding. There are several well known JS frameworks that provide this kind of features more or less automagically. I will list them with increasing complexity, so that the simplest to learn come first. Note that they are of course not the most powerful.

Then there is one critical point of your setup that is not trivially solved in general: the pre-loading. This feature is not provided out of the box by any framework, except Meteor! Even in Meteor you will have to decide what is (pre)loaded using the publish-subscribe pattern. In other frameworks you will have to research best practice solutions for how to preload data invisibly, but it is certainly doable.

  • Knockout.js / Backbone.js: both well known and not too heavy frontend frameworks.
  • Angular.js / Ember.js: again both well known. Ember is better maintained, in the sense that the Angular team is going to drop all backward compatibility with the soon to come Angular2.
  • Meteor.js: this is a different story. Meteor comes with a never before combined set of very powerful features but is a full-stack framework with MongoDB only (PostgreSQL soon coming).
  • A personal, opinionated comment: being in a similar situation as you, I decided to go with Meteor. Today I would say: choose Meteor if and only if you are about to implement a dialog / page oriented UI with little cross-referencing in the data model. If you have a convoluted, heavily relational data model and an accordingly convoluted UI, choose separate tools. – B M Oct 22 '15 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.