| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,6 +81,13 @@ application.on(application.uncaughtErrorEvent, function(args: application.Unhand | |||
| 81 | 81 | console.log("### stack: " + args.error.stack); | |
| 82 | 82 | }); | |
| 83 | 83 | ||
| 84 | + application.on(application.discardedErrorEvent, function(args: application.DiscardedErrorEventData) { | ||
| 85 | + console.log("### [Discarded] NativeScriptError: " + args.error); | ||
| 86 | + console.log("### [Discarded] nativeException: " + (<any>args.error).nativeException); | ||
| 87 | + console.log("### [Discarded] stackTrace: " + (<any>args.error).stackTrace); | ||
| 88 | + console.log("### [Discarded] stack: " + args.error.stack); | ||
| 89 | + }); | ||
| 90 | + | ||
| 84 | 91 | application.setCssFileName("ui-tests-app/app.css"); | |
| 85 | 92 | ||
| 86 | 93 | application.start({ moduleName: "ui-tests-app/main-page" }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -90,6 +90,12 @@ application.on(application.uncaughtErrorEvent, function (args: application.Unhan | |||
| 90 | 90 | console.log((<any>args.error).stackTrace || (<any>args.error).stack); | |
| 91 | 91 | }); | |
| 92 | 92 | ||
| 93 | + application.on(application.discardedErrorEvent, function (args: application.DiscardedErrorEventData) { | ||
| 94 | + console.log("[Discarded] NativeScriptError: " + args.error); | ||
| 95 | + console.log((<any>args.error).nativeException || (<any>args.error).nativeError); | ||
| 96 | + console.log((<any>args.error).stackTrace || (<any>args.error).stack); | ||
| 97 | + }); | ||
| 98 | + | ||
| 93 | 99 | // Android activity events | |
| 94 | 100 | if (application.android) { | |
| 95 | 101 | application.android.on(application.AndroidApplication.activityCreatedEvent, function (args: application.AndroidActivityBundleEventData) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,10 +38,11 @@ import { | |||
| 38 | 38 | getRootView, | |
| 39 | 39 | iOSApplication, | |
| 40 | 40 | LoadAppCSSEventData, | |
| 41 | - UnhandledErrorEventData | ||
| 41 | + UnhandledErrorEventData, | ||
| 42 | + DiscardedErrorEventData | ||
| 42 | 43 | } from "./application"; | |
| 43 | 44 | ||
| 44 | - export { UnhandledErrorEventData, CssChangedEventData, LoadAppCSSEventData }; | ||
| 45 | + export { UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData }; | ||
| 45 | 46 | ||
| 46 | 47 | export const launchEvent = "launch"; | |
| 47 | 48 | export const suspendEvent = "suspend"; | |
@@ -50,6 +51,7 @@ export const resumeEvent = "resume"; | |||
| 50 | 51 | export const exitEvent = "exit"; | |
| 51 | 52 | export const lowMemoryEvent = "lowMemory"; | |
| 52 | 53 | export const uncaughtErrorEvent = "uncaughtError"; | |
| 54 | + export const discardedErrorEvent = "discardedError"; | ||
| 53 | 55 | export const orientationChangedEvent = "orientationChanged"; | |
| 54 | 56 | ||
| 55 | 57 | let cssFile: string = "./app.css"; | |
@@ -122,3 +124,7 @@ export function addCss(cssText: string): void { | |||
| 122 | 124 | global.__onUncaughtError = function (error: NativeScriptError) { | |
| 123 | 125 | events.notify(<UnhandledErrorEventData>{ eventName: uncaughtErrorEvent, object: app, android: error, ios: error, error: error }); | |
| 124 | 126 | } | |
| 127 | + | ||
| 128 | + global.__onDiscardedError = function (error: NativeScriptError) { | ||
| 129 | + events.notify(<DiscardedErrorEventData>{ eventName: discardedErrorEvent, object: app, error: error }); | ||
| 130 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,11 @@ export var displayedEvent: string; | |||
| 21 | 21 | */ | |
| 22 | 22 | export var uncaughtErrorEvent: string; | |
| 23 | 23 | ||
| 24 | + /** | ||
| 25 | + * String value used when hooking to discardedError event. | ||
| 26 | + */ | ||
| 27 | + export var discardedErrorEvent: string; | ||
| 28 | + | ||
| 24 | 29 | /** | |
| 25 | 30 | * String value used when hooking to suspend event. | |
| 26 | 31 | */ | |
@@ -103,6 +108,13 @@ export interface UnhandledErrorEventData extends ApplicationEventData { | |||
| 103 | 108 | error: NativeScriptError; | |
| 104 | 109 | } | |
| 105 | 110 | ||
| 111 | + /** | ||
| 112 | + * Event data containing information about discarded application errors. | ||
| 113 | + */ | ||
| 114 | + export interface DiscardedErrorEventData extends ApplicationEventData { | ||
| 115 | + error: NativeScriptError; | ||
| 116 | + } | ||
| 117 | + | ||
| 106 | 118 | /** | |
| 107 | 119 | * Event data containing information about application css change. | |
| 108 | 120 | */ | |
@@ -137,7 +149,7 @@ export function setResources(res: any): void; | |||
| 137 | 149 | export function setResources(resources: any); | |
| 138 | 150 | ||
| 139 | 151 | /** | |
| 140 | - * Sets css file name for the application. | ||
| 152 | + * Sets css file name for the application. | ||
| 141 | 153 | */ | |
| 142 | 154 | export function setCssFileName(cssFile: string): void; | |
| 143 | 155 | ||
@@ -199,7 +211,7 @@ export function shouldCreateRootFrame(): boolean; | |||
| 199 | 211 | ||
| 200 | 212 | /** | |
| 201 | 213 | * A basic method signature to hook an event listener (shortcut alias to the addEventListener method). | |
| 202 | - * @param eventNames - String corresponding to events (e.g. "onLaunch"). Optionally could be used more events separated by `,` (e.g. "onLaunch", "onSuspend"). | ||
| 214 | + * @param eventNames - String corresponding to events (e.g. "onLaunch"). Optionally could be used more events separated by `,` (e.g. "onLaunch", "onSuspend"). | ||
| 203 | 215 | * @param callback - Callback function which will be executed when event is raised. | |
| 204 | 216 | * @param thisArg - An optional parameter which will be used as `this` context for callback execution. | |
| 205 | 217 | */ | |
@@ -262,6 +274,11 @@ export function on(event: "lowMemory", callback: (args: ApplicationEventData) => | |||
| 262 | 274 | */ | |
| 263 | 275 | export function on(event: "uncaughtError", callback: (args: UnhandledErrorEventData) => void, thisArg?: any); | |
| 264 | 276 | ||
| 277 | + /** | ||
| 278 | + * This event is raised when an discarded error occurs while the application is running. | ||
| 279 | + */ | ||
| 280 | + export function on(event: "discardedError", callback: (args: DiscardedErrorEventData) => void, thisArg?: any); | ||
| 281 | + | ||
| 265 | 282 | /** | |
| 266 | 283 | * This event is raised the orientation of the current device has changed. | |
| 267 | 284 | */ | |
@@ -403,13 +420,13 @@ export class AndroidApplication extends Observable { | |||
| 403 | 420 | /** | |
| 404 | 421 | * Initialized the android-specific application object with the native android.app.Application instance. | |
| 405 | 422 | * This is useful when creating custom application types. | |
| 406 | - * @param nativeApp - the android.app.Application instance that started the app. | ||
| 423 | + * @param nativeApp - the android.app.Application instance that started the app. | ||
| 407 | 424 | */ | |
| 408 | 425 | init: (nativeApp) => void; | |
| 409 | 426 | ||
| 410 | 427 | /** | |
| 411 | 428 | * A basic method signature to hook an event listener (shortcut alias to the addEventListener method). | |
| 412 | - * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change"). | ||
| 429 | + * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change"). | ||
| 413 | 430 | * @param callback - Callback function which will be executed when event is raised. | |
| 414 | 431 | * @param thisArg - An optional parameter which will be used as `this` context for callback execution. | |
| 415 | 432 | */ | |
@@ -516,15 +533,15 @@ export class AndroidApplication extends Observable { | |||
| 516 | 533 | public static activityRequestPermissionsEvent: string; | |
| 517 | 534 | ||
| 518 | 535 | /** | |
| 519 | - * Register a BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application thread. | ||
| 536 | + * Register a BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application thread. | ||
| 520 | 537 | * For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#registerReceiver%28android.content.BroadcastReceiver,%20android.content.IntentFilter%29' | |
| 521 | 538 | * @param intentFilter A string containing the intent filter. | |
| 522 | 539 | * @param onReceiveCallback A callback function that will be called each time the receiver receives a broadcast. | |
| 523 | 540 | */ | |
| 524 | 541 | registerBroadcastReceiver(intentFilter: string, onReceiveCallback: (context: any /* android.content.Context */, intent: any /* android.content.Intent */) => void): void; | |
| 525 | 542 | ||
| 526 | 543 | /** | |
| 527 | - * Unregister a previously registered BroadcastReceiver. | ||
| 544 | + * Unregister a previously registered BroadcastReceiver. | ||
| 528 | 545 | * For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#unregisterReceiver(android.content.BroadcastReceiver)' | |
| 529 | 546 | * @param intentFilter A string containing the intent filter with which the receiver was originally registered. | |
| 530 | 547 | */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ declare var global: NodeJS.Global; | |||
| 3 | 3 | interface ModuleResolver { | |
| 4 | 4 | /** | |
| 5 | 5 | * A function used to resolve the exports for a module. | |
| 6 | - * @param uri The name of the module to be resolved. | ||
| 6 | + * @param uri The name of the module to be resolved. | ||
| 7 | 7 | */ | |
| 8 | 8 | (uri: string): any; | |
| 9 | 9 | } | |
@@ -18,7 +18,7 @@ declare namespace NodeJS { | |||
| 18 | 18 | * Register all modules from a webpack context. | |
| 19 | 19 | * The context is one created using the following webpack utility: | |
| 20 | 20 | * https://webpack.github.io/docs/context.html | |
| 21 | - * | ||
| 21 | + * | ||
| 22 | 22 | * The extension map is optional, modules in the webpack context will have their original file extension (e.g. may be ".ts" or ".scss" etc.), | |
| 23 | 23 | * while the built-in module builders in {N} will look for ".js", ".css" or ".xml" files. Adding a map such as: | |
| 24 | 24 | * ``` | |
@@ -54,6 +54,7 @@ declare namespace NodeJS { | |||
| 54 | 54 | __onLiveSync: (context?: { type: string, module: string }) => void; | |
| 55 | 55 | __onLiveSyncCore: () => void; | |
| 56 | 56 | __onUncaughtError: (error: NativeScriptError) => void; | |
| 57 | + __onDiscardedError: (error: NativeScriptError) => void; | ||
| 57 | 58 | TNS_WEBPACK?: boolean; | |
| 58 | 59 | __requireOverride?: (name: string, dir: string) => any; | |
| 59 | 60 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments