Code Monkey home page Code Monkey logo

Comments (9)

jasnell avatar jasnell commented on June 1, 2024 3

Possibly ... there are quite a few differences between Node.js workers and Web workers but many of the basic concepts hold. What may be easiest would be a separate piscina-web module that implements as much of the API as consistently as possible.

from piscina.

tuananh avatar tuananh commented on June 1, 2024 2

I was assuming it can use any npm module that is not Node specific. I cant find any docs via quick google search. I will try later today.

Another use case would be offloading computation expensive task from main thread.

from piscina.

mcollina avatar mcollina commented on June 1, 2024

My starting question is.. what would you need it for on the Web? Could you please describe your use case?

from piscina.

tuananh avatar tuananh commented on June 1, 2024

My starting question is.. what would you need it for on the Web? Could you please describe your use case?

Eg: Serverless offering like cloudflare workers can only use modules that works on the web (via webpack)

from piscina.

mcollina avatar mcollina commented on June 1, 2024

Are you sure you can use Web Workers inside a cloudflare Service Worker? Can you link some docs?

More importantly, what would be the use case for doing so?

from piscina.

jasnell avatar jasnell commented on June 1, 2024

Going to leave this open a feature request. There are definitely some possibility here but most likely this would need to be implemented as a completely separate module.

from piscina.

eligrey avatar eligrey commented on June 1, 2024

I made a basic web worker thread pool for browsers as part of Penumbra.

from piscina.

dusty-phillips avatar dusty-phillips commented on June 1, 2024

As far as use case goes, we are building a (I know it sounds crazy) crypto miner intended to run on node and in browser. Piscina is working great on node, and it would be nice to have in the browser with same API as well.

For some people looking for this, threads.js may be a cross-platform option, but it is not nearly so ergonomic as piscina, and it completely failed in the face of our WASM code.

from piscina.

SouthernPL avatar SouthernPL commented on June 1, 2024

我假设它可以使用任何非 Node 特定的 npm 模块。我无法通过快速谷歌搜索找到任何文档。我今天晚些时候试试。

另一个用例是从主线程卸载计算成本高的任务。

i need too!!!

from piscina.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.