async-library / react-webworker Goto Github PK
View Code? Open in Web Editor NEW⚙️ Communicate with a Web Worker from React
License: ISC License
⚙️ Communicate with a Web Worker from React
License: ISC License
Perhaps I confused but can we get a method to post to the worker in a function?
I used a reference in react on the object and tried the follow but it did not work:
refWorker.postMessage
How can I get access to that worker from functions in the page?
Can I have an example with create-react-app?
I've tried to implement this lib within create-react-app project but it does not work.
It seems my worker.js has something wrong.
component.js
<WebWorker url="/worker.js">
{({ data, error, postMessage }) => {
if (error) return `Something went wrong: ${error.message}`
if (data)
return (
<div>
<strong>Received some data:</strong>
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
)
return <button onClick={() => postMessage('hello')}>Hello</button>
}}
</WebWorker>
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.
react
, react-dom
)These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
react
, react-dom
)package.json
babel-cli 6.26.0
babel-preset-env 1.7.0
babel-preset-flow 6.23.0
babel-preset-react 6.24.1
babel-preset-stage-2 6.24.1
jest 23.5.0
jest-dom 1.12.0
react 16.4.2
react-dom 16.4.2
react-testing-library 5.0.0
react >=16.3.0
.travis.yml
<WebWorker url={getOneUrl(
/repositories/${repoId}/merge_requests/${mrIid}`)}>
{diffData.changes.map((v) => (
<Card
id={v.id}
diff={v.diff}
source={v.source}
viewType={viewType}
diffComment={filterCommentById(v.id)}
name={v.newPath || v.oldPath}
newPath={v.newPath}
oldPath={v.oldPath}
renamedFile={v.renamedFile}
addLinesCount={v.addLinesCount}
deleteLinesCount={v.deleteLinesCount}
/>
))}
</WebWorker>`
Parcel is able to automatically create a JS bundle when it sees new Worker('path')
. I'm order to support this, react-webworker must allow the user to pass such Worker instance to <Worker>
instead of having it create its own internal instance based on the provided url
.
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.