Send the AnnotationStorage
-data to the worker-thread as a Map
#13001
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rather than converting the
AnnotationStorage
-data to an Object, before sending it to the worker-thread, we should be able to simply send the internalMap
directly.The "structured clone algorithm" doesn't have a problem with
Map
s, however theLoopbackPort
used when workers are disabled (e.g. in Node.js environments) didn't use to support them. With PR #12997 having lifted that restriction, we should now be able to simply send theAnnotationStorage
-data as-is rather than having to iterate through it to first create an Object.Please note: The changes in
src/core/annotation.js
could have been a lot more compact if we were able to use optional chaining in thesrc/core
folder. Unfortunately that's still not possible, since SystemJS is being used in the development viewer (i.g.gulp server
) and fixing that is still blocked by bug 1247687.