MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / load

Method load

packages/core/ui/builder/index.ts:124–134  ·  view source on GitHub ↗

* Loads component from module with context * @param moduleName the module name * @param exports the context of the component to be loaded

(pathOrOptions: string | LoadOptions, context?: any)

Source from the content-addressed store, hash-verified

122 * @param exports the context of the component to be loaded
123 */
124 static load(pathOrOptions: string | LoadOptions, context?: any): View {
125 let componentModule: ComponentModule;
126 if (typeof pathOrOptions === 'string') {
127 const moduleName = sanitizeModuleName(pathOrOptions);
128 componentModule = loadInternal(moduleName, context);
129 } else {
130 componentModule = loadCustomComponent(pathOrOptions.path, pathOrOptions.name, pathOrOptions.attributes, pathOrOptions.exports, pathOrOptions.page, true);
131 }
132
133 return componentModule && componentModule.component;
134 }
135
136 /**
137 * Creates an array of KeyedTemplates from string

Calls 3

sanitizeModuleNameFunction · 0.90
loadInternalFunction · 0.85
loadCustomComponentFunction · 0.85

Tested by

no test coverage detected