Comments (4)
Yes, I have been thinking about it a bit. I have a small module that I was planning on incorporating eventually: https://github.com/nolanlawson/promise-worker
However, it may be inappropriate because actually the sender of the WW message and the receiver are not necessarily the same component. In general I actually really like the event handler model (simple, vanilla, less code, more obvious); is there another approach you think would be better?
from pokedex.org.
I'm looking at this more from 'the other side' : I'd like the code in the web worker to register event handlers. I think having your render functions also register the event handlers is, for me at least, much more natural.
As for how this would work: serializing functions is impossible, but I was thinking about another step in the vdom process that would walk the vtree and replace every function with a unique string or number, plus add this to a map from unique id -> function. Then on the UI thread side there'd be just a simple event handler that sends the number back to the web worker. The web worker can then consult the map and find which function to execute.
This is just a conceptual overview, there are some annoying things to take care of in an actual implementation, but I do think this could work.
from pokedex.org.
Then on the UI thread side there'd be just a simple event handler that sends the number back to the web worker.
That's pretty much what promise-worker does. :)
from pokedex.org.
That's pretty much what promise-worker does. :)
Oooh yeah, I hadn't looked into the implementation of promise-worker but it's definitely a similar line of thought! I don't think promise-worker itself could help with this "issue" though.
from pokedex.org.
Related Issues (20)
- Evee has undefined in evolution
- Trying to update but there's a number of missing resources HOT 3
- Panel animation blip when mouse plugged in
- Interesting error stack in UC browser when going into detail view HOT 4
- UC Browser compat HOT 3
- Store images using Cache API HOT 1
- Description for Mew showing as Mewtwo HOT 3
- Visual irregularity in back button on Chrome dev HOT 1
- monsters-search-bar is missing a label HOT 1
- Add gen 7 HOT 2
- Find (Ctrl+F) is broken HOT 2
- More Pokemon please!
- Scroll position is reset when opening pokemon details
- How could you open in new window on desktop version?
- Android HOT 1
- Updating build scripts HOT 3
- No Generation 6 And 7 Pokemon info
- Ghost/Dark types have wrong weaknesses
- Catch rate of all pokemons is 0
- Add Maskable icons HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pokedex.org.