Files
NativeScript/apps/app/ui-tests-app/action-bar/action-item-position.ts
Hristo Deshev 629eb6e683 Use relative imports in tns-core-modules.
Use tns-core-modules/* imports in outside code (apps, tests, etc)
2017-03-13 14:37:59 +02:00

40 lines
953 B
TypeScript

import { EventData } from "tns-core-modules/data/observable";
import { Page } from "tns-core-modules/ui/page";
import * as observable from "tns-core-modules/data/observable";
export function navigatingTo(args: EventData) {
let page = <Page>args.object;
page.bindingContext = new ActionItemPostitionView();
}
export class ActionItemPostitionView extends observable.Observable {
private _values = ["-i---", "---i---", "---i-"];
private _count: number;
private _text: string;
constructor() {
super();
this._count = 0;
}
get text(): string {
return this._text;
}
set text(value: string) {
if (this._text !== value) {
this._text = value;
this.notifyPropertyChange("text", value)
}
}
public onTap() {
this.change();
}
public change() {
let index = this._count++ % 3;
this.text = this._values[index];
}
}