21gramconsulting / usetaskqueue Goto Github PK
View Code? Open in Web Editor NEW21Gram Consulting's React hook for managing queues of tasks.
Home Page: https://21gramconsulting.github.io/useTaskQueue
License: MIT License
21Gram Consulting's React hook for managing queues of tasks.
Home Page: https://21gramconsulting.github.io/useTaskQueue
License: MIT License
A task queue's input queue is processed as soon as we put something into it. That behavior is correct.
As soon as processing starts, the items get popped from it. That is also correct.
Therefore it may seem like it's redundant, but it is not! It serves the purpose of when in a react application a lot of things happen, during, between, before, or after a render for example, things may hang around.
This is why we use the dispatch set action approaches instead of simple setters.
Now, all that said, we should somehow create UAT tests for such cases. I didn't have any ideas yet, but most likely it's trivial.
As a user of the library it's normal to do this:
useTaskQueue({
name: 'test',
codec: json.number,
task: v => [v * 2, v * 3, v * 4],
})
The problem is, that doing so in a react component or a wrapper hook, the task function's reference will always "change" therefore React will assume, that our memorized value should be re-evaluated.
const task = useMemo(() => descriptor.task, [descriptor.task]);
Gotta somehow fix react's function change detection.
Ok, so our internal solution has storage-based features.
Local, session, you name it.
The problem of course is that synchronization between open runtimes & stuff contains some proprietary IP which I'm not willing to release (for at least this year).
The task is to come up with a simple primitive basic solution that's good enough for open-source.
There are some implementation sketches, and we keep the API open, as in, this library pretends to provide the feature based on its function contract, like with the expectation to provide a codec
.
This stuff will be added with a minor release.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.