Resolved #199: TabView.selectedIndexChanged event.

This commit is contained in:
Rossen Hristov
2015-05-21 13:47:53 +03:00
parent 26864ddb63
commit a4b2457708
5 changed files with 122 additions and 4 deletions

View File

@@ -4,6 +4,7 @@
declare module "ui/tab-view" {
import view = require("ui/core/view");
import dependencyObservable = require("ui/core/dependency-observable");
import observable = require("data/observable");
/**
* Represents a tab view entry.
@@ -25,6 +26,21 @@ declare module "ui/tab-view" {
iconSource?: string;
}
/**
* Defines the data for the TabView.selectedIndexChanged event.
*/
export interface SelectedIndexChangedEventData extends observable.EventData {
/**
* The old selected index.
*/
oldIndex: number;
/**
* The new selected index.
*/
newIndex: number;
}
/**
* Represents a tab view.
*/
@@ -51,5 +67,23 @@ declare module "ui/tab-view" {
* Gets the native iOS [UITabBarController](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITabBarController_Class/) that represents the user interface for this component. Valid only when running on iOS.
*/
ios: UITabBarController;
/**
* String value used when hooking to the selectedIndexChanged event.
*/
public static selectedIndexChangedEvent: string;
/**
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
* @param callback - Callback function which will be executed when event is raised.
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
*/
on(eventNames: string, callback: (data: observable.EventData) => void, thisArg?: any);
/**
* Raised when the selected index changes.
*/
on(event: "selectedIndexChanged", callback: (args: SelectedIndexChangedEventData) => void, thisArg?: any);
}
}