mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Strong types for builder.load parameters. Hopefully better intellisense.
This commit is contained in:
@@ -223,19 +223,21 @@ function loadCustomComponent(componentPath: string, componentName?: string, attr
|
||||
return result;
|
||||
}
|
||||
|
||||
export function load(arg: any): view.View {
|
||||
export function load(pathOrOptions: string | definition.LoadOptions, context?: any): view.View {
|
||||
var viewToReturn: view.View;
|
||||
var componentModule: componentBuilder.ComponentModule;
|
||||
|
||||
if (arguments.length === 1) {
|
||||
if (!types.isString(arguments[0])) {
|
||||
var options = <definition.LoadOptions>arguments[0];
|
||||
if (!context) {
|
||||
if (!types.isString(pathOrOptions)) {
|
||||
var options = <definition.LoadOptions>pathOrOptions;
|
||||
componentModule = loadCustomComponent(options.path, options.name, undefined, options.exports, options.page);
|
||||
} else {
|
||||
componentModule = loadInternal(<string>arguments[0]);
|
||||
var path = <string>pathOrOptions;
|
||||
componentModule = loadInternal(path);
|
||||
}
|
||||
} else {
|
||||
componentModule = loadInternal(<string>arguments[0], arguments[1]);
|
||||
var path = <string>pathOrOptions;
|
||||
componentModule = loadInternal(path, context);
|
||||
}
|
||||
|
||||
if (componentModule) {
|
||||
@@ -315,4 +317,4 @@ function getExports(instance: view.View): any {
|
||||
}
|
||||
|
||||
return parent ? (<any>parent).exports : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user