Support dynamic import calls (#4652)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-07-24 09:26:46 +02:00
committed by GitHub
parent d9360f51d0
commit d4178ae386
21 changed files with 698 additions and 114 deletions
+19
View File
@@ -869,6 +869,25 @@ jerry_module_get_namespace (const jerry_value_t module_val) /**< module */
#endif /* JERRY_MODULE_SYSTEM */
} /* jerry_module_get_namespace */
/**
* Sets the callback which is called when dynamic imports are resolved
*/
void
jerry_module_set_import_callback (jerry_module_import_callback_t callback_p, /**< callback which handles
* dynamic import calls */
void *user_p) /**< user pointer passed to the callback */
{
jerry_assert_api_available ();
#if JERRY_MODULE_SYSTEM
JERRY_CONTEXT (module_import_callback_p) = callback_p;
JERRY_CONTEXT (module_import_callback_user_p) = user_p;
#else /* !JERRY_MODULE_SYSTEM */
JERRY_UNUSED (callback_p);
JERRY_UNUSED (user_p);
#endif /* JERRY_MODULE_SYSTEM */
} /* jerry_module_set_import_callback */
/**
* Creates a native module with a list of exports. The initial state of the module is linked.
*