d3-delaunay: Error with es6 worker + es6 modules

Hi,

I’m getting the following error when trying to include your lib in js worker (paint-worklet to be exact).

Uncaught (in promise) ReferenceError: self is not defined

Can you either chain and or change the self to globalThis (is supported by all relevant browsers as far as I am aware).

Or even better, if I can bother you with this job, create a delaunay.min.esm so I can just use es6 modules as is 😄

Thanks in advance!!!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

fixed in d3-delaunay@6

Oh oh! You would do https://observablehq.com/@fil/walk-on-spheres-worker in gradient.js?

sorry for the late response, I seem to have overlooked this on my vacation.

I don’t believe I would use the tatic used in your link as the 2dcontext provided by a paintworklet, while intended to be similar, is not the same as a canvas. One of the differences is no ability to draw pixel per pixel. In this case meaning that I need some nasty workaround to calculate each pixels color based on a polygon somehow.

my current thinking is to use what I have above and then somehow place some linear gradients on the edges.

Thanks!!! works like a charm!