GithubHelp home page GithubHelp logo

Comments (2)

bmeck avatar bmeck commented on May 13, 2024 2

Service Workers use cases seem a fine to hope they match, but various things like having a HTTP cache implementation as the means of controlling things like file: URLs likely won't match up in implementation. Additionally, service workers have a concept of origins that doesn't make as much sense on the backend and prevent seeing cross origin requests.

Loader use cases are more complex, but we do have some insurance that the model can be emulated in the web and vice versa with proof of concepts we generate every so often so we do consider compatibility but not design important.

A polyfill of ServiceWorker on top of --loader is possible by injecting a global during globalPreload and then having the loader spin up a worker. I think having some ship for it would be good but I doubt it would land in Node's core anytime soon, certainly not before loaders are fully stabilized.

from loaders.

frank-dspeed avatar frank-dspeed commented on May 13, 2024

@bmeck i also invested into the serviceWorker concept and i guess it is importent to have it including the origin level while that is blocking and looking like none sense in first case out of my view it would help to algin the ecosystems as also would enable some really nice extra usecases

Explainer Web Worker API (Concept)

i vote for a complet serviceWorker implementation as also bind it to a Web Worker Specification so a NodeJS WebWorker will offer fetch (the full spec) including the context like location as web workers do it in the browser and finally this web workers would be able to instantiate service workers

the browser got a so called activation api to init the service worker and directly activate it via api without page reload this will be the standard behavior of the node implementation

and finaly we did it we enabled nodejs users to run stuff in a isolated by url context.

and also made clear that this is not needed for none web development

the web worker will also expose Web Streams and Web Crypto directly it will be like the browser implementation of it

the configuration of the Web Worker new webWorker() will offer configuration options for the cache and the whole policy headers.

loader related alternative

register the service worker via a loader and then this service worker will only work for the nodejs Web Worker API if the context matches.

from loaders.

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.