UNPKG

1.52 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 * A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
30 * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
31 * @param callback - Callback function which will be executed when event is raised.
32 * @param thisArg - An optional parameter which will be used as `this` context for callback execution.
33 */
34 on(eventNames: string, callback: (data: EventData) => void, thisArg?: any);
35
36 /**
37 * Raised when a tap event occurs.
38 */
39 on(event: 'tap', callback: (args: EventData) => void, thisArg?: any);
40}