-
Notifications
You must be signed in to change notification settings - Fork 1.2k
FetchImportedModuleFromScriptCallBack
Richard edited this page Feb 23, 2018
·
1 revision
User implemented callback to fetch imported modules dynamically in scripts.
typedef JsErrorCode (CHAKRA_CALLBACK * FetchImportedModuleFromScriptCallBack)(
_In_ JsSourceContext dwReferencingSourceContext,
_In_ JsValueRef specifier,
_Outptr_result_maybenull_ JsModuleRecord* dependentModuleRecord);
- dwReferencingSourceContext: The referencing script context that calls import()
- specifier: The specifier provided to the import() call.
- dependentModuleRecord: The ModuleRecord of the dependent module. If the module was requested before from other source, return the existing ModuleRecord, otherwise return a newly created ModuleRecord.
Returns JsNoError if the operation succeeded or an error code otherwise.
The callback is invoked on the current runtime execution thread, therefore execution is blocked until the callback completes. Notify the host to fetch the dependent module. This is used for the dynamic import() syntax.
Callback should:
- Check if the requested module has been requested before - if yes return the existing module record
- If no create and initialize a new module record with JsInitializeModuleRecord to return and schedule a call to JsParseModuleSource for the new record.
- Architecture Overview
- Building ChakraCore
- ChakraCore Code Structure
- Contributor Guidance
- Engineering Notes
- Embedding ChakraCore
- Testing ChakraCore
- Getting ChakraCore binaries
- Label Glossary
- Resources
- Roadmap / Release Notes
Want to contribute to this Wiki? Fork it and send a pull request!