UNPKG

1.45 kBTypeScriptView Raw
1import { TextBase } from '../text-base';
2import { EventData } from '../../data/observable';
3
4/**
5 * Represents a standard Button widget.
6 */
7export class Button extends TextBase {
8 /**
9 * String value used when hooking to tap event.
10 */
11 public static tapEvent: string;
12
13 /**
14 * Gets the native [android widget](http://developer.android.com/reference/android/widget/Button.html) that represents the user interface for this component. Valid only when running on Android OS.
15 */
16 android: any /* android.widget.Button */;
17
18 /**
19 * Gets the native [UIButton](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIButton_Class/) that represents the user interface for this component. Valid only when running on iOS.
20 */
21 ios: any /* UIButton */;
22
23 /**
24 * Gets or sets whether the Button wraps text or not.
25 */
26 textWrap: boolean;
27
28 /**
29 * Adds a listener for the specified event name.
30 *
31 * @param eventName The name of the event.
32 * @param callback The event listener to add. Will be called when an event of
33 * the given name is raised.
34 * @param thisArg An optional parameter which, when set, will be bound as the
35 * `this` context when the callback is called. Falsy values will be not be
36 * bound.
37 */
38 on(eventName: string, callback: (data: EventData) => void, thisArg?: any): void;
39
40 /**
41 * Raised when a tap event occurs.
42 */
43 on(event: 'tap', callback: (args: EventData) => void, thisArg?: any): void;
44}