UNPKG

1.41 kBTypeScriptView Raw
1import { View } from '../core/view';
2import { EventData } from '../../data/observable';
3
4export * from './placeholder-common';
5
6/**
7 * Represents a Placeholder, which is used to add a native view to the visual tree.
8 */
9export class Placeholder extends View {
10 /**
11 * String value used when hooking to creatingView event.
12 */
13 public static creatingViewEvent: string;
14
15 /**
16 * A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
17 * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
18 * @param callback - Callback function which will be executed when event is raised.
19 * @param thisArg - An optional parameter which will be used as `this` context for callback execution.
20 */
21 on(eventNames: string, callback: (args: EventData) => void, thisArg?: any): void;
22
23 /**
24 * Raised when a creatingView event occurs.
25 */
26 on(event: 'creatingView', callback: (args: CreateViewEventData) => void, thisArg?: any): void;
27}
28
29/**
30 * Event data containing information for creating a native view that will be added to the visual tree.
31 */
32export interface CreateViewEventData extends EventData {
33 /**
34 * The native view that should be added to the visual tree.
35 */
36 view: any;
37
38 /**
39 * An optional context for creating the view.
40 */
41 context?: any;
42}