mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
Making tslint happy.
This commit is contained in:
@ -57,15 +57,17 @@ export function eachDescendant(view: definition.View, callback: (child: View) =>
|
||||
|
||||
export function getAncestor(view: View, criterion: string | Function): definition.View {
|
||||
let matcher: (view: definition.View) => boolean = null;
|
||||
if (typeof criterion === "string")
|
||||
if (typeof criterion === "string") {
|
||||
matcher = (view: definition.View) => view.typeName === criterion;
|
||||
else
|
||||
} else {
|
||||
matcher = (view: definition.View) => view instanceof criterion;
|
||||
}
|
||||
|
||||
for (let parent: definition.View = view.parent; parent != null; parent = parent.parent) {
|
||||
if (matcher(parent))
|
||||
if (matcher(parent)) {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -337,8 +339,9 @@ export class View extends proxy.ProxyObject implements definition.View {
|
||||
}
|
||||
|
||||
get page(): definition.View {
|
||||
if (this.parent)
|
||||
if (this.parent) {
|
||||
return this.parent.page;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user