Asynchronous fetch for internal resources
We currently use synchronous fetches for Saxon-JS internal resources: opt/functions.json used by function-available(); opt/categories.json used for some advanced regex; and lib/xpath/XPathJS.min.js. But we should use asynchronous fetches. We need to work out the best way to do this. Possible options:
Require the developer to load the required resources, e.g. by providing an API method to be called in an HTML script.
Read from the SEF that the resource will be needed, and fetch during initialisation (before starting the transform).
(1) is not ideal because this is adds work for the developer, when we did not previously require the use of such features to be stated up front. If resources are not correctly loaded then an application may break.
A problem with (2) is that we do not necessarily know at compile time that resources (e.g. categories.json) will be required.
Updated by Debbie Lockett almost 4 years ago
- Description updated (diff)
- Status changed from New to Resolved
- Fix Committed on JS Branch Trunk added
All dynamic loading of internal resources has been eliminated for Saxon-JS 2.0. The internal resources which were dynamically loaded as required for Saxon-JS 1.x (opt/functions.json, opt/categories.json, and lib/xpath/XPathJS.min.j) will be built-in for Saxon-JS 2.0.
(Note that during development for Saxon-JS 2.0, we had the option of using dynamic loading to obtain the XX compiler. This will also be removed for the released product. For the browser release, we will have two versions: a "min" version which does not include the XX compiler, and a bigger "full" version which does.)
Please register to edit this issue