mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
18 lines
602 B
TypeScript
18 lines
602 B
TypeScript
import { CoreTypes } from '@nativescript/core';
|
|
import * as pageModule from '@nativescript/core/ui/page';
|
|
import * as model from './myview';
|
|
|
|
export function onLoaded(args: { eventName: string; object: any }) {
|
|
var page = <pageModule.Page>args.object;
|
|
page.bindingContext = new model.ViewModel();
|
|
}
|
|
|
|
export function onOrientation(args: { eventName: string; object: any }) {
|
|
var layout = args.object.parent;
|
|
if (layout.orientation === CoreTypes.Orientation.vertical) {
|
|
layout.orientation = CoreTypes.Orientation.horizontal;
|
|
} else {
|
|
layout.orientation = CoreTypes.Orientation.vertical;
|
|
}
|
|
}
|