mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: update tslint rules (#7391)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Require globals first so that snapshot takes __extends function.
|
||||
// Require globals first so that snapshot takes __extends function.
|
||||
require("globals");
|
||||
|
||||
import { Observable, EventData } from "../data/observable";
|
||||
@@ -124,8 +124,8 @@ export function addCss(cssText: string): void {
|
||||
|
||||
global.__onUncaughtError = function (error: NativeScriptError) {
|
||||
events.notify(<UnhandledErrorEventData>{ eventName: uncaughtErrorEvent, object: app, android: error, ios: error, error: error });
|
||||
}
|
||||
};
|
||||
|
||||
global.__onDiscardedError = function (error: NativeScriptError) {
|
||||
events.notify(<DiscardedErrorEventData>{ eventName: discardedErrorEvent, object: app, error: error });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import {
|
||||
AndroidActivityBundleEventData, AndroidActivityEventData, ApplicationEventData, OrientationChangedEventData,
|
||||
AndroidApplication as AndroidApplicationDefinition, AndroidActivityNewIntentEventData,
|
||||
AndroidActivityResultEventData, AndroidActivityBackPressedEventData, AndroidActivityRequestPermissionsEventData
|
||||
@@ -142,13 +142,13 @@ export function _start(entry?: NavigationEntry | string) {
|
||||
}
|
||||
}
|
||||
|
||||
export function _shouldCreateRootFrame(): boolean {
|
||||
return createRootFrame.value;
|
||||
}
|
||||
export function _shouldCreateRootFrame(): boolean {
|
||||
return createRootFrame.value;
|
||||
}
|
||||
|
||||
export function run(entry?: NavigationEntry | string) {
|
||||
createRootFrame.value = false;
|
||||
_start(entry);
|
||||
export function run(entry?: NavigationEntry | string) {
|
||||
createRootFrame.value = false;
|
||||
_start(entry);
|
||||
}
|
||||
|
||||
const CALLBACKS = "_callbacks";
|
||||
@@ -207,7 +207,7 @@ export function getNativeApplication(): android.app.Application {
|
||||
|
||||
// we cannot work without having the app instance
|
||||
if (!nativeApp) {
|
||||
throw new Error("Failed to retrieve native Android Application object. If you have a custom android.app.Application type implemented make sure that you've called the '<application-module>.android.init' method.")
|
||||
throw new Error("Failed to retrieve native Android Application object. If you have a custom android.app.Application type implemented make sure that you've called the '<application-module>.android.init' method.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,6 +370,7 @@ function ensureBroadCastReceiverClass() {
|
||||
constructor(onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void) {
|
||||
super();
|
||||
this._onReceiveCallback = onReceiveCallback;
|
||||
|
||||
return global.__native(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import {
|
||||
iOSApplication as IOSApplicationDefinition,
|
||||
LaunchEventData,
|
||||
ApplicationEventData,
|
||||
@@ -44,6 +44,7 @@ class NotificationObserver extends NSObject {
|
||||
public static initWithCallback(onReceiveCallback: (notification: NSNotification) => void): NotificationObserver {
|
||||
const observer = <NotificationObserver>super.new();
|
||||
observer._onReceiveCallback = onReceiveCallback;
|
||||
|
||||
return observer;
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@ class CADisplayLinkTarget extends NSObject {
|
||||
}
|
||||
public static ObjCExposedMethods = {
|
||||
"onDisplayed": { returns: interop.types.void, params: [CADisplayLink] }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class IOSApplication implements IOSApplicationDefinition {
|
||||
@@ -121,6 +122,7 @@ class IOSApplication implements IOSApplicationDefinition {
|
||||
const observer = NotificationObserver.initWithCallback(onReceiveCallback);
|
||||
NSNotificationCenter.defaultCenter.addObserverSelectorNameObject(observer, "onReceive", notificationName, null);
|
||||
this._observers.push(observer);
|
||||
|
||||
return observer;
|
||||
}
|
||||
|
||||
@@ -277,7 +279,7 @@ setApplication(iosApp);
|
||||
// attach on global, so it can be overwritten in NativeScript Angular
|
||||
(<any>global).__onLiveSyncCore = function (context?: ModuleContext) {
|
||||
iosApp._onLivesync(context);
|
||||
}
|
||||
};
|
||||
|
||||
let mainEntry: NavigationEntry;
|
||||
function createRootView(v?: View) {
|
||||
@@ -366,6 +368,7 @@ function getViewController(view: View): UIViewController {
|
||||
// At the moment the root view doesn't have its native view created. We set it in the setViewControllerView func
|
||||
viewController = iosView.UILayoutViewController.initWithOwner(new WeakRef(view)) as UIViewController;
|
||||
view.viewController = viewController;
|
||||
|
||||
return viewController;
|
||||
}
|
||||
}
|
||||
@@ -390,4 +393,4 @@ global.__onLiveSync = function __onLiveSync(context?: ModuleContext) {
|
||||
|
||||
const rootView = getRootView();
|
||||
livesync(rootView, context);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user