Neo.mjs – Webworker-driven UI framework
github.com
github.com
Things like things I have invented in the past (before they were public):
- React - Redux - This thing - Various other things
In fact, I wrote a UI framework that runs in Web Workers which does React+Redux better than React+Redux. Redux is terrible for real-time work, whereas my framework combined beautifully for real-time work. As real-time as you can get in the browser anyway. And I could throttle FPS perfectly as a result.
I know I'm not the only one who creates these things, and I know I'm onto something usually because the "old guard" generally are terrified of this new thing that I built.
I am old. And I think I am probably wrong when inventing things which terrify other people but I'd like to figure out how to find a more... amenable audience, not just in my work, which is mostly independent now.
How do I find people who see possibilities? Should I be talking about these things at meetups? How do things go from my own personal products/projects to being posted on HN?
Also related to this article, webworkers are great for offloading work from the main thread until you've got high data rates. It doesn't take a lot of data to get to the point where serialization across the worker boundary nullifies the performance gains of moving the work off of the main thread.
Regarding your comment about serialization: that's why I used websockets in the workers. It went pretty well except there was a bug in Chrome where the websocket in the webworker was still subject to the main loop. Something like that.
Anyway, the point of offloading everything to webworkers was to make sure that the main thread is free for rendering. So there was very little to serialize, aside from dom differences which are generally not significant.
Look at angular, the full backing of google yet people moved to react... and now to vue which was basically made by one guy
Some open source authors are already very well connected. Sometimes the projects are backed by a large company. There are several ways to get the word out.
I need to have better ways to get the word out.
This sounds like something I might want to use for a project in my pipeline, with "thing that works well and terrifies the old guard" being in the spirit of "post-blub"[0] languages (think APL rarely using function definitions because the concise syntax[1] makes inlining more readable).
[0]: http://paulgraham.com/avg.html [1]: This is a single-file compiler. The logic is just the upper weird-symbol-laden part: https://github.com/Co-dfns/Co-dfns/blob/master/codfns.dyalog
In general humans are afraid of radical new ideas (at least most). There is also the "riding the wave" phenomenon, which is slowing down innovations to some degree.
Meetups or conference sessions are a good start, since the audience ist mostly curious.
On the repo you have an apps folder (RW2 is a better example) as well as an examples folder.
If you open the online examples => docs app, you can view into the code for all classes. If you use the docs app version with the Chrome flag, all available examples are included.
I don't really buy the template argument. Think declarative layouts such as QML, React, etc. are there for a reason...
Why focus that much on mjs? Wouldn't you use Typescript anyway? i.e. you still have source map (beside I never had problems with source maps)
did you try using the mouse-wheel? (scrollY does zoom, srollX rotates). please let me know in case the performance doing so is not nice.
so far neo.mjs is just using input type="range" for sliders, which are ok-ish on MacOS. real sliders are on my todo list, but to implement them i need to create drag and drop first. this one is an epic, since drag happens inside the main thread while the handlers live within the app worker. i will update the vision file today to shed some light into what is coming next.
the template discussion is a big one :) you could argument that most APIs were XML 5+ years ago and now close to all are JSON based. imo writing string based markups is a legacy thing which should get replaced. think about it this way: to compare virtual dom and get the deltas, vdom structures have to be json based (js objects & arrays). in case you write markup strings, they need to get converted into JSON, which is expensive. you could argument now, that those replacements can be done as a build process, which is true if you want to limit your components to just a few states. imagine you would create the helix using states and how many templates you would need => there would be a massive overhead to load all those parsed templates.
neo.mjs goes one step further: you can not just define your markup as JSON, but this structure(s) are persistent throughout the component lifecycle. meaning you can change them the same way before & after a component gets mounted.
the whole scoping madness including functions or variables into strings just does not exist, which can save a lot of time. also, the part where you put a component based tag into a string based template which automatically creates a matching JS instance does not exist, which makes it very convenient to re-use the same components (think about a list with component based items).
i would use TS in a heartbeat if browsers would support it out of the box. one major design goal of neo.mjs is to not have any JS related build processes for the dev mode. the benefit to debug the real code should be obvious (transpiling code can create bugs).
i recommend to take a look into the ES class system extensions as well, especially the config system (see src/Neo.mjs).
Maybe have a look at old multithreaded BeOS demos and consider to implement something like that. For example, do some heavy work in some workers while the UI thread renders the ongoing results in a smooth animation and let users dynamically change the number workers (BeOS had a demo which allowed user to switch cpus on/off during rendering with fully responsive UI).
* the config system + setter getter and update functions
* framework code readability, clean code with comments with nicely formatted and readable
* cutting edge feature support - it’s refreshing to work and play with ES8, multiple web workers, etc. (you know that most buisness projects are not cutting edge ;))
* support - @tobiu was/is super responsive and helpful with my questions when get started
Working on the "neo-app" package and planning to get it done by January 2nd. Then you can create new neo.mjs apps with a 1-liner npx script.
The vdom itself is very different to other frameworks, since it is JSON based. neo.mjs is not using any templates at all, which boosts the performance a lot.
The motivation part would be a long story :)
This brings us to the roadmap of Neo and to when we can be sure that our customers can use our sites written in Neo.
What I see now is "For the best user experience, you need to use Google Chrome with the following browser flag: chrome://flags/#enable-experimental-web-platform-features". Maybe this means that we should only wait for Chrome 80+ to be on most desktops.
Firefox: all I got there is a number of "SyntaxError: import declarations may only appear at top level of a module". Which version of Firefox do we have to wait for?
Safari: I don't own any device from Apple but a number of my customers do. I wonder if Neo works there.
Other browsers: I assume that all the chromium based browsers are going to be covered by the compatibility with Chrome 80.
Mobile: "The online demos are not optimised for mobile yet, please use a desktop browser!" Is it only a matter of CSS or is there something about webworkers on those platforms?
You can run the dist/development and dist/production versions of neo inside FF & Safari right now, the performance should be close.
Having 1 browser which fully supports it is enough for a great debugging experience. Obviously it would be nice if other browsers do catch up.
Mobile: I need to add support for touch events inside the main thread, which should be easy. On my todo list after the real world 2 app is done (want to focus on this one first, since it is meant to be a good starting point for new devs to get up to speed). The multithreading performance will be amazing on mobile.
The thing is, applying DOM updates is the biggest bottleneck in almost every frontend app. And this doesn't sound like it solves that.
in this (neo.mjs) case main applies the deltas, forwards dom events to the app worker & serves as a message bus as long as workers can not directly communicate. nothing more.
Great work!
If so: https://medium.com/passpill-project/files-with-mjs-extension...
It got popular in nodejs first to name files containing JS modules .mjs, but it starting to get a standard inside browsers as well.
You can find a lot more references in case you google for it, e.g.: https://dev.to/saigowthamr/js-modules-are-now-supporting-in-...
Best regards Tobias
Browsers don't care about the file extension, just the mime-type. Node supports modules with any extension now as well. I wouldn't use .mjs, it causes lots of problems.
feel free to open a ticket inside the issues tracker with more input about the problems and i will look into it.
This is a new paradigm: you can now include JS modules directly into workers inside the browser. This will be fully supported in Chrome 80 (already works in canary). The concept makes debugging extremely convenient, since you get the real code without source-maps and the multi-threading gives a relly nice performance.
I just donated 1.5 years of my full and unpaid working time to the open source community with this :)
The dist versions work there, but for the dev mode, they need to catch up. The biggest problem is, that FF & Safari do not support modules inside the worker scope at all (although it is inside the W3C specs for a very long time). On top of this, FF does not support dynamic imports (they recently changed the dynamic import detection from a parse time to a run time error => before this point even unreachable code broke it).
https://github.com/neomjs/neo/tree/dev/docs/app/view
(e.g. look into the MainContainer & the matching controller)