Fixed wrong event names in application.d.ts + added constants for the Android Activity Events + reordering of members + a small tslint fix.

This commit is contained in:
Rossen Hristov
2015-07-07 12:13:24 +03:00
parent 165461cee3
commit abc561762c
5 changed files with 93 additions and 43 deletions

View File

@@ -9,16 +9,11 @@ var events = new observable.Observable();
require("utils/module-merge").merge(events, exports);
export var launchEvent = "launch";
export var uncaughtErrorEvent = "uncaughtError";
export var suspendEvent = "suspend";
export var resumeEvent = "resume";
export var exitEvent = "exit";
export var lowMemoryEvent = "lowMemory";
export var uncaughtErrorEvent = "uncaughtError";
export var cssFile: string = "app.css"

View File

@@ -136,7 +136,17 @@ app.init({
}
});
class AndroidApplication extends observable.Observable implements dts.AndroidApplication {
export class AndroidApplication extends observable.Observable implements dts.AndroidApplication {
public static activityCreatedEvent = "activityCreated";
public static activityDestroyedEvent = "activityDestroyed";
public static activityStartedEvent = "activityStarted";
public static activityPausedEvent = "activityPaused";
public static activityResumedEvent = "activityResumed";
public static activityStoppedEvent = "activityStopped";
public static saveActivityStateEvent = "saveActivityState";
public static activityResultEvent = "activityResult";
public static activityBackPressedEvent = "activityBackPressed";
public nativeApp: android.app.Application;
public context: android.content.Context;
public currentContext: android.content.Context;

View File

@@ -161,32 +161,32 @@ declare module "application" {
/**
* This event is raised on application launchEvent.
*/
export function on(event: "onLaunch", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when an uncaught error occurs while the application is running.
*/
export function on(event: "onUncaughtError", callback: (args: ApplicationEventData) => void, thisArg?: any);
export function on(event: "launch", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is suspended.
*/
export function on(event: "onSuspend", callback: (args: ApplicationEventData) => void, thisArg?: any);
export function on(event: "suspend", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is resumed after it has been suspended.
*/
export function on(event: "onResume", callback: (args: ApplicationEventData) => void, thisArg?: any);
export function on(event: "resume", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is about to exitEvent.
*/
export function on(event: "onExit", callback: (args: ApplicationEventData) => void, thisArg?: any);
export function on(event: "exit", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when there is low memory on the target device.
*/
export function on(event: "onLowMemory", callback: (args: ApplicationEventData) => void, thisArg?: any);
export function on(event: "lowMemory", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when an uncaught error occurs while the application is running.
*/
export function on(event: "uncaughtError", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This is the Android-specific application object instance.
@@ -395,6 +395,51 @@ declare module "application" {
* This event is raised on the back button is pressed in an android application.
*/
on(event: "activityBackPressed", callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any);
/**
* String value used when hooking to activityCreated event.
*/
public static activityCreatedEvent: string;
/**
* String value used when hooking to activityDestroyed event.
*/
public static activityDestroyedEvent: string;
/**
* String value used when hooking to activityStarted event.
*/
public static activityStartedEvent: string;
/**
* String value used when hooking to activityPaused event.
*/
public static activityPausedEvent: string;
/**
* String value used when hooking to activityResumed event.
*/
public static activityResumedEvent: string;
/**
* String value used when hooking to activityStopped event.
*/
public static activityStoppedEvent: string;
/**
* String value used when hooking to saveActivityState event.
*/
public static saveActivityStateEvent: string;
/**
* String value used when hooking to activityResult event.
*/
public static activityResultEvent: string;
/**
* String value used when hooking to activityBackPressed event.
*/
public static activityBackPressedEvent: string;
}
/* tslint:disable */