Skip to content

pavelpave/WWm

Repository files navigation

WWm - WEB WORCKER MODULE

Created for WebWorcker

Exemple use

url: this is a link to the file

data: this is the data that you want to transfer to the worker

type: this is the type worcker module or classic

app.js

let instanse = new PromiseWorker({
  url: '/web-worker/index.js',
  type: 'module',
})
  .init()
  .invoke(data)
  .then((el) => {
    return el;
  });

worcker.js

self.onmessage = async ($event) => {
  if ($event && $event.data.data) {
    let result = serializer($event.data.data); // custom function for calculations
    results = {
      data: result,
      id: $event.data.id,
    };
    self.postMessage(results);
  }
};

Trabls

  • the problem is in the react with a link to a file in the src folder, I recommend putting your files with workers in the public folder

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published