events naming updated

This commit is contained in:
Vladimir Enchev
2015-06-01 17:04:06 +03:00
parent a8be503417
commit a3070bef83
6 changed files with 40 additions and 40 deletions

View File

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

View File

@@ -44,7 +44,7 @@ var initEvents = function () {
exports.onExit();
}
exports.notify({ eventName: dts.exit, object: androidApp, android: activity });
exports.notify({ eventName: dts.exitEvent, object: androidApp, android: activity });
androidApp.startActivity = undefined;
}
@@ -62,7 +62,7 @@ var initEvents = function () {
exports.onSuspend();
}
exports.notify({ eventName: dts.suspend, object: androidApp, android: activity });
exports.notify({ eventName: dts.suspendEvent, object: androidApp, android: activity });
}
@@ -76,7 +76,7 @@ var initEvents = function () {
exports.onResume();
}
exports.notify({ eventName: dts.resume, object: androidApp, android: activity });
exports.notify({ eventName: dts.resumeEvent, object: androidApp, android: activity });
}
@@ -192,7 +192,7 @@ class AndroidApplication implements dts.AndroidApplication {
exports.onLaunch(intent);
}
exports.notify({ eventName: dts.launch, object: this, android: intent });
exports.notify({ eventName: dts.launchEvent, object: this, android: intent });
/* In the onLaunch event we expect the following setup, which ensures a root frame:
* var frame = require("ui/frame");
@@ -236,7 +236,7 @@ global.__onUncaughtError = function (error: Error) {
exports.onUncaughtError(nsError);
exports.notify({ eventName: dts.uncaughtError, object: appModule.android, android: error });
exports.notify({ eventName: dts.uncaughtErrorEvent, object: appModule.android, android: error });
}
exports.start = function () {

View File

@@ -18,32 +18,32 @@ declare module "application" {
/**
* String value used when hooking to launch event.
*/
export var launch: string;
export var launchEvent: string;
/**
* String value used when hooking to uncaughtError event.
*/
export var uncaughtError: string;
export var uncaughtErrorEvent: string;
/**
* String value used when hooking to suspend event.
*/
export var suspend: string;
export var suspendEvent: string;
/**
* String value used when hooking to resume event.
*/
export var resume: string;
export var resumeEvent: string;
/**
* String value used when hooking to exit event.
* String value used when hooking to exitevent.
*/
export var exit: string;
export var exitEvent: string;
/**
* String value used when hooking to lowMemory event.
*/
export var lowMemory: string;
export var lowMemoryEvent: string;
/**
* Event data containing information for the application events.
@@ -119,7 +119,7 @@ declare module "application" {
export function onResume();
/**
* This method will be called when the Application is about to exit.
* This method will be called when the Application is about to exitEvent.
*/
export function onExit();
@@ -149,7 +149,7 @@ declare module "application" {
export function hasListeners(eventName: string): boolean;
/**
* This event is raised on application launch.
* This event is raised on application launchEvent.
*/
export function on(event: "onLaunch", callback: (args: any) => void, thisArg?: any);
@@ -169,7 +169,7 @@ declare module "application" {
export function on(event: "onResume", callback: (args: any) => void, thisArg?: any);
/**
* This event is raised when the Application is about to exit.
* This event is raised when the Application is about to exitEvent.
*/
export function on(event: "onExit", callback: (args: any) => void, thisArg?: any);

View File

@@ -50,7 +50,7 @@ class TNSAppDelegate extends UIResponder implements UIApplicationDelegate {
exports.onLaunch();
}
exports.notify({ eventName: definition.launch, object: this, ios: launchOptions });
exports.notify({ eventName: definition.launchEvent, object: this, ios: launchOptions });
var topFrame = frame.topmost();
if (!topFrame) {
@@ -77,7 +77,7 @@ class TNSAppDelegate extends UIResponder implements UIApplicationDelegate {
exports.onResume();
}
exports.notify({ eventName: definition.resume, object: this, ios: application });
exports.notify({ eventName: definition.resumeEvent, object: this, ios: application });
}
applicationWillResignActive(application: UIApplication) {
@@ -89,7 +89,7 @@ class TNSAppDelegate extends UIResponder implements UIApplicationDelegate {
exports.onSuspend();
}
exports.notify({ eventName: definition.suspend, object: this, ios: application });
exports.notify({ eventName: definition.suspendEvent, object: this, ios: application });
}
applicationWillEnterForeground(application: UIApplication) {
@@ -101,7 +101,7 @@ class TNSAppDelegate extends UIResponder implements UIApplicationDelegate {
exports.onExit();
}
exports.notify({ eventName: definition.exit, object: this, ios: application });
exports.notify({ eventName: definition.exitEvent, object: this, ios: application });
}
applicationDidReceiveMemoryWarning(application: UIApplication) {
@@ -109,7 +109,7 @@ class TNSAppDelegate extends UIResponder implements UIApplicationDelegate {
exports.onLowMemory();
}
exports.notify({ eventName: definition.lowMemory, object: this, android: undefined, ios: application });
exports.notify({ eventName: definition.lowMemoryEvent, object: this, android: undefined, ios: application });
}
applicationOpenURLSourceApplicationAnnotation(application: UIApplication, url: NSURL, sourceApplication: string, annotation: any): boolean {
@@ -158,6 +158,6 @@ exports.start = function () {
exports.onUncaughtError(error);
definition.notify({ eventName: definition.uncaughtError, object: <any>definition.ios, ios: error });
definition.notify({ eventName: definition.uncaughtErrorEvent, object: <any>definition.ios, ios: error });
}
}

View File

@@ -1,29 +1,29 @@
import application = require("application");
application.mainModule = "app/mainPage";
application.on(application.launch, function (args: application.ApplicationEventData) {
console.log("launch, iOS: " + args.ios + ", Android: " + args.android);
application.on(application.launchEvent, function (args: application.ApplicationEventData) {
console.log("launchEvent, iOS: " + args.ios + ", Android: " + args.android);
});
application.on(application.uncaughtError, function (args: application.ApplicationEventData) {
console.log("uncaughtError, iOS: " + args.ios + ", Android: " + args.android);
application.on(application.uncaughtErrorEvent, function (args: application.ApplicationEventData) {
console.log("uncaughtErrorEvent, iOS: " + args.ios + ", Android: " + args.android);
});
application.on(application.suspend, function (args: application.ApplicationEventData) {
console.log("suspend, iOS: " + args.ios + ", Android: " + args.android);
application.on(application.suspendEvent, function (args: application.ApplicationEventData) {
console.log("suspendEvent, iOS: " + args.ios + ", Android: " + args.android);
});
application.on(application.resume, function (args: application.ApplicationEventData) {
console.log("resume, iOS: " + args.ios + ", Android: " + args.android);
application.on(application.resumeEvent, function (args: application.ApplicationEventData) {
console.log("resumeEvent, iOS: " + args.ios + ", Android: " + args.android);
});
application.on(application.exit, function (args: application.ApplicationEventData) {
console.log("exit, iOS: " + args.ios + ", Android: " + args.android);
application.on(application.exitEvent, function (args: application.ApplicationEventData) {
console.log("exitEvent, iOS: " + args.ios + ", Android: " + args.android);
});
application.on(application.lowMemory, function (args: application.ApplicationEventData) {
console.log("exit, iOS: " + args.ios + ", Android: " + args.android);
application.on(application.lowMemoryEvent, function (args: application.ApplicationEventData) {
console.log("exitEvent, iOS: " + args.ios + ", Android: " + args.android);
});

View File

@@ -495,7 +495,7 @@ var NativeActivity = {
java.lang.System.gc();
this.super.onLowMemory();
application.notify(<application.ApplicationEventData>{ eventName: application.lowMemory, object: this });
application.notify(<application.ApplicationEventData>{ eventName: application.lowMemoryEvent, object: this });
},
onTrimMemory: function (level: number) {