Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE support for Web Workers #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Harvinator
Copy link

The problem

IE Web Workers don't support BLOB URL's.

This solution

#58 (comment)

This fix allows the user to place the Web Worker code in an external file then specify the path where they have made it available on their web server.

Usage

L.vectorGrid.slicer(geoJson, {
    workerCode: '/path/to/Leaflet.VectorGrid/WebWorker.js',
    [...]
}).addTo(map);

A better solution

The solution in this pull request requires the worker code to be stringified in the distributed code (as it currently is) and then the exact same code copied in an external file (for those who need to support IE).

A better approach would be to use a similar method to ng-webworker whereby the external web worker is just a shell that executes whatever is passed to it. This way it avoids duplicating the code and the external web worker file size is a much smaller to download.

With this approach you keep the stringified worker in the distributed code (as it currently is) then pass the string in memory to the worker shell which just eval's it.

https://github.com/mattslocum/ng-webworker/blob/master/README.md (IE workarounds)

Worker shell example
https://github.com/mattslocum/ng-webworker/blob/master/src/worker_wrapper.js

This fix allows the user to place the Web Worker code in an external file then specify the path where they have made it available on their web server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant