1 | import { View } from '../core/view';
|
2 | import { EventData } from '../../data/observable';
|
3 |
|
4 | export * from './placeholder-common';
|
5 |
|
6 | /**
|
7 | * Represents a Placeholder, which is used to add a native view to the visual tree.
|
8 | */
|
9 | export class Placeholder extends View {
|
10 | /**
|
11 | * String value used when hooking to creatingView event.
|
12 | */
|
13 | public static creatingViewEvent: string;
|
14 |
|
15 | /**
|
16 | * Adds a listener for the specified event name.
|
17 | *
|
18 | * @param eventName The name of the event.
|
19 | * @param callback The event listener to add. Will be called when an event of
|
20 | * the given name is raised.
|
21 | * @param thisArg An optional parameter which, when set, will be bound as the
|
22 | * `this` context when the callback is called. Falsy values will be not be
|
23 | * bound.
|
24 | */
|
25 | on(eventName: string, callback: (args: EventData) => void, thisArg?: any): void;
|
26 |
|
27 | /**
|
28 | * Raised when a creatingView event occurs.
|
29 | */
|
30 | on(event: 'creatingView', callback: (args: CreateViewEventData) => void, thisArg?: any): void;
|
31 | }
|
32 |
|
33 | /**
|
34 | * Event data containing information for creating a native view that will be added to the visual tree.
|
35 | */
|
36 | export interface CreateViewEventData extends EventData {
|
37 | /**
|
38 | * The native view that should be added to the visual tree.
|
39 | */
|
40 | view: any;
|
41 |
|
42 | /**
|
43 | * An optional context for creating the view.
|
44 | */
|
45 | context?: any;
|
46 | }
|