Load a :class:`WebModule` from a :data:`URL_SOURCE` Parameters: url: Where the javascript module will be loaded from which conforms to the interface for :ref:`Custom Javascript Components` fallback: What to temporarily display while the module
(
url: str,
fallback: Any | None = None,
resolve_exports: bool | None = None,
resolve_exports_depth: int = 5,
unmount_before_update: bool = False,
)
| 31 | |
| 32 | |
| 33 | def module_from_url( |
| 34 | url: str, |
| 35 | fallback: Any | None = None, |
| 36 | resolve_exports: bool | None = None, |
| 37 | resolve_exports_depth: int = 5, |
| 38 | unmount_before_update: bool = False, |
| 39 | ) -> WebModule: |
| 40 | """Load a :class:`WebModule` from a :data:`URL_SOURCE` |
| 41 | |
| 42 | Parameters: |
| 43 | url: |
| 44 | Where the javascript module will be loaded from which conforms to the |
| 45 | interface for :ref:`Custom Javascript Components` |
| 46 | fallback: |
| 47 | What to temporarily display while the module is being loaded. |
| 48 | resolve_imports: |
| 49 | Whether to try and find all the named exports of this module. |
| 50 | resolve_exports_depth: |
| 51 | How deeply to search for those exports. |
| 52 | unmount_before_update: |
| 53 | Cause the component to be unmounted before each update. This option should |
| 54 | only be used if the imported package fails to re-render when props change. |
| 55 | Using this option has negative performance consequences since all DOM |
| 56 | elements must be changed on each render. See :issue:`461` for more info. |
| 57 | """ |
| 58 | return WebModule( |
| 59 | source=url, |
| 60 | source_type=URL_SOURCE, |
| 61 | default_fallback=fallback, |
| 62 | file=None, |
| 63 | export_names=( |
| 64 | resolve_module_exports_from_url(url, resolve_exports_depth) |
| 65 | if ( |
| 66 | resolve_exports |
| 67 | if resolve_exports is not None |
| 68 | else REACTPY_DEBUG_MODE.current |
| 69 | ) |
| 70 | else None |
| 71 | ), |
| 72 | unmount_before_update=unmount_before_update, |
| 73 | ) |
| 74 | |
| 75 | |
| 76 | _FROM_TEMPLATE_DIR = "__from_template__" |
nothing calls this directly
no test coverage detected