mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: format
This commit is contained in:
@@ -2,20 +2,25 @@ import { CreateViewEventData } from "./placeholder-common";
|
||||
import { View, CSSType } from "../core/view";
|
||||
import { EventData } from "../../data/observable";
|
||||
|
||||
export * from './placeholder-common';
|
||||
export * from "./placeholder-common";
|
||||
|
||||
@CSSType("Placeholder")
|
||||
export class Placeholder extends View {
|
||||
public static creatingViewEvent = "creatingView";
|
||||
public static creatingViewEvent = "creatingView";
|
||||
|
||||
public createNativeView() {
|
||||
const args = <CreateViewEventData>{ eventName: Placeholder.creatingViewEvent, object: this, view: undefined, context: this._context };
|
||||
this.notify(args);
|
||||
public createNativeView() {
|
||||
const args = <CreateViewEventData>{
|
||||
eventName: Placeholder.creatingViewEvent,
|
||||
object: this,
|
||||
view: undefined,
|
||||
context: this._context,
|
||||
};
|
||||
this.notify(args);
|
||||
|
||||
return <android.view.View>args.view;
|
||||
}
|
||||
return <android.view.View>args.view;
|
||||
}
|
||||
}
|
||||
export interface Placeholder {
|
||||
on(eventNames: string, callback: (args: EventData) => void);
|
||||
on(event: "creatingView", callback: (args: CreateViewEventData) => void);
|
||||
on(eventNames: string, callback: (args: EventData) => void);
|
||||
on(event: "creatingView", callback: (args: CreateViewEventData) => void);
|
||||
}
|
||||
|
||||
48
nativescript-core/ui/placeholder/index.d.ts
vendored
48
nativescript-core/ui/placeholder/index.d.ts
vendored
@@ -1,42 +1,42 @@
|
||||
import { View } from "../core/view";
|
||||
import { EventData } from "../../data/observable";
|
||||
|
||||
export * from './placeholder-common';
|
||||
export * from "./placeholder-common";
|
||||
|
||||
/**
|
||||
* Represents a Placeholder, which is used to add a native view to the visual tree.
|
||||
*/
|
||||
export class Placeholder extends View {
|
||||
/**
|
||||
* String value used when hooking to creatingView event.
|
||||
*/
|
||||
public static creatingViewEvent: string;
|
||||
/**
|
||||
* String value used when hooking to creatingView event.
|
||||
*/
|
||||
public static creatingViewEvent: 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: (args: EventData) => void);
|
||||
/**
|
||||
* 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: (args: EventData) => void);
|
||||
|
||||
/**
|
||||
* Raised when a creatingView event occurs.
|
||||
*/
|
||||
on(event: "creatingView", callback: (args: CreateViewEventData) => void);
|
||||
/**
|
||||
* Raised when a creatingView event occurs.
|
||||
*/
|
||||
on(event: "creatingView", callback: (args: CreateViewEventData) => void);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information for creating a native view that will be added to the visual tree.
|
||||
*/
|
||||
export interface CreateViewEventData extends EventData {
|
||||
/**
|
||||
* The native view that should be added to the visual tree.
|
||||
*/
|
||||
view: any;
|
||||
/**
|
||||
* The native view that should be added to the visual tree.
|
||||
*/
|
||||
view: any;
|
||||
|
||||
/**
|
||||
* An optional context for creating the view.
|
||||
*/
|
||||
context?: any;
|
||||
/**
|
||||
* An optional context for creating the view.
|
||||
*/
|
||||
context?: any;
|
||||
}
|
||||
|
||||
@@ -2,19 +2,24 @@ import { View } from "../core/view";
|
||||
import { CreateViewEventData } from "./placeholder-common";
|
||||
import { EventData } from "../../data/observable";
|
||||
|
||||
export * from './placeholder-common';
|
||||
export * from "./placeholder-common";
|
||||
|
||||
export class Placeholder extends View {
|
||||
public static creatingViewEvent = "creatingView";
|
||||
public static creatingViewEvent = "creatingView";
|
||||
|
||||
public createNativeView() {
|
||||
const args = <CreateViewEventData>{ eventName: Placeholder.creatingViewEvent, object: this, view: undefined, context: this._context };
|
||||
this.notify(args);
|
||||
public createNativeView() {
|
||||
const args = <CreateViewEventData>{
|
||||
eventName: Placeholder.creatingViewEvent,
|
||||
object: this,
|
||||
view: undefined,
|
||||
context: this._context,
|
||||
};
|
||||
this.notify(args);
|
||||
|
||||
return args.view;
|
||||
}
|
||||
return args.view;
|
||||
}
|
||||
}
|
||||
export interface Placeholder {
|
||||
on(eventNames: string, callback: (args: EventData) => void);
|
||||
on(event: "creatingView", callback: (args: CreateViewEventData) => void);
|
||||
on(eventNames: string, callback: (args: EventData) => void);
|
||||
on(event: "creatingView", callback: (args: CreateViewEventData) => void);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { EventData } from "../../data/observable";
|
||||
|
||||
export interface CreateViewEventData extends EventData {
|
||||
/**
|
||||
* The native view that should be added to the visual tree.
|
||||
*/
|
||||
view: any;
|
||||
/**
|
||||
* The native view that should be added to the visual tree.
|
||||
*/
|
||||
view: any;
|
||||
|
||||
/**
|
||||
* An optional context for creating the view.
|
||||
*/
|
||||
context?: any;
|
||||
}
|
||||
/**
|
||||
* An optional context for creating the view.
|
||||
*/
|
||||
context?: any;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user