How to use the webworker-promise/lib/register function in webworker-promise

To help you get started, we’ve selected a few webworker-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kitware / vtk-js / Sources / Filters / General / PaintFilter / PaintFilter.worker.js View on Github external
thresh[ii] -= delta[ii];
              if (thresh[ii] < 0) {
                thresh[ii] = step;
                pt[ii] += inc[ii];
              }
            }
          }
        }
      }
    }
  }

  globals.prevPoint = point;
}

registerWebworker()
  .operation('start', ({ bufferType, dimensions }) => {
    const bufferSize = dimensions[0] * dimensions[1] * dimensions[2];
    /* eslint-disable-next-line */
    globals.buffer = new self[bufferType](bufferSize);
    globals.dimensions = dimensions;
    globals.prevPoint = null;
  })
  .operation('paint', handlePaint)
  .operation(
    'end',
    () =>
      new registerWebworker.TransferableResponse(globals.buffer.buffer, [
        globals.buffer.buffer,
      ])
  );

webworker-promise

Promise for webworkers

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis