Update: Darkwasp joined Domy project (web components).
Most of the websites right now use one processor core out of many, by doing so they reduce the user experience considerably, freezing the entire web in its actual state of progress. In the era of Deep Learning and real-time experience, it seems that the web hit the wall.
Why is this all happening? The reason is dead simple — thread safety. Web Workers were made isolated by design and the most inconvenient thing out of this is the constraint to run the Web Worker from a separate file.
Consequently, to facilitate the work with parallel processes in web environment, we came out with new library called The Dark Wasp. In a nutshell, the idea is to save the biggest part of the web app code in the storage and load it on request in a separate thread, no need to load the entire codebase all at once. The same functions could be used in frontend and backend (web browser or Node.js).
To access the storage, we’ll need the name of the storage itself - “app” property and the unique identifier of the current user - “peer” property. If the storage with the given name doesn’t exist, it’ll be created and the user will get owners rights. Latest joined users will have limited rights, being simple peers.
Now, for the sake of example, let’s create a random function:
In the example above, app.wasp.random.set() means create the wasp (lambda function) with the name “random” and the code which follows in set() method. In the same time, storage doesn’t exist, so the “peer” will get owner rights.
Next, deliver the function to the storage by executing the file:
node store.js
Done! Further use of stored functions is a piece of cake, in the browser it looks as follows:
… and the Node.js environment (the “peer” is not the first, so no special treatment in this case)