Use esri/rest in webworker error

342
2
10-19-2021 09:42 AM
QingXu
by
New Contributor II

  I am trying to use javascript api esri/rest/query in a webworker.

 But at run time, it got error 'typeError: _global_js__WEBPACK_IMPORTED_MODULE_1__.default.invokeStaticMessage is not a function".

  Does Arcgis javascript api support using esri/rest/query  in webworker?  If yes, could you help to let me know what I am missing?

   Below are parts of the code in webworker?

import * as query from '@arcgis/core/rest/query';
 ...
 query.executeForCount(queryOptions, { url: layerUrl });  // This causes the error above.
 
   Thanks!

 

Tags (1)
0 Kudos
2 Replies
ReneRubalcava
Frequent Contributor

I tested out doing a query in the worker using this sample without errors.

https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-custom-workers

 

Look over that sample and see if you can find some tips on how to get it to work in your project.

QingXu
by
New Contributor II

  I didn't use the worker framework from the javascript api.  I just implemented a regular webworker in angular. Do I need to do any esri config setting to make the webworker working?  

   Thanks!

0 Kudos