Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FetchImportedModuleCallback

Richard edited this pageFeb 23, 2018 ·1 revision

User implemented callback to fetch additional imported modules in ES modules.

Syntax

typedef JsErrorCode (CHAKRA_CALLBACK * FetchImportedModuleCallBack)(    _In_ JsModuleRecord referencingModule,    _In_ JsValueRef specifier,    _Outptr_result_maybenull_ JsModuleRecord* dependentModuleRecord);

Parameters

  • referencingModule: The referencing module that is requesting the dependent module.
  • specifier: The specifier coming from the module source code.
  • 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.

Return Value

Returns aJsNoError if the operation succeeded an error code otherwise.

Remarks

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 the "import" part before HostResolveImportedModule in ES6 spec.

This notifies the host that the referencing module has the specified module dependency, and the host needs to retrieve the module back.

Callback should:

  1. Check if the requested module has been requested before - if yes return the existing module record
  2. If no create and initialize a new module record with JsInitializeModuleRecord to return and schedule a call to JsParseModuleSource for the new record.

Want to contribute to this Wiki?

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp