mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Add 'displayed' event on application for iOS
This commit is contained in:
@ -195,7 +195,9 @@ export function hasListeners(eventName: string): boolean;
|
||||
export function on(event: "launch", callback: (args: LaunchEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised after the application has launched and was fully drawn.
|
||||
* This event is raised after the application has performed most of its startup actions.
|
||||
* Its intent is to be suitable for measuring app startup times.
|
||||
* @experimental
|
||||
*/
|
||||
export function on(event: "displayed", callback: (args: EventData) => void, thisArg?: any);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import {
|
||||
notify, launchEvent, resumeEvent, suspendEvent, exitEvent, lowMemoryEvent,
|
||||
orientationChangedEvent, setApplication, livesync
|
||||
orientationChangedEvent, setApplication, livesync, displayedEvent
|
||||
} from "./application-common";
|
||||
|
||||
// First reexport so that app module is initialized.
|
||||
@ -16,6 +16,8 @@ class Responder extends UIResponder {
|
||||
//
|
||||
}
|
||||
|
||||
let displayedOnce = false;
|
||||
|
||||
class Window extends UIWindow {
|
||||
public content;
|
||||
|
||||
@ -138,7 +140,13 @@ class IOSApplication implements IOSApplicationDefinition {
|
||||
}
|
||||
|
||||
private didBecomeActive(notification: NSNotification) {
|
||||
notify(<ApplicationEventData>{ eventName: resumeEvent, object: this, ios: utils.ios.getter(UIApplication, UIApplication.sharedApplication) });
|
||||
let ios = utils.ios.getter(UIApplication, UIApplication.sharedApplication);
|
||||
let object = this;
|
||||
notify(<ApplicationEventData>{ eventName: resumeEvent, object, ios });
|
||||
if (!displayedOnce) {
|
||||
notify(<ApplicationEventData>{ eventName: displayedEvent, object, ios });
|
||||
displayedOnce = true;
|
||||
}
|
||||
}
|
||||
|
||||
private didEnterBackground(notification: NSNotification) {
|
||||
|
Reference in New Issue
Block a user