mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Apply getter check to determine if API is exposed as property or as method for iOS backward compatibility
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import common = require("./image-cache-common");
|
||||
import utils = require("utils/utils");
|
||||
import trace = require("trace");
|
||||
import * as httpRequestModule from "http/http-request";
|
||||
|
||||
import * as utils from "utils/utils";
|
||||
import getter = utils.ios.getter;
|
||||
|
||||
var httpRequest: typeof httpRequestModule;
|
||||
function ensureHttpRequest() {
|
||||
if (!httpRequest) {
|
||||
@@ -32,7 +34,7 @@ class MemmoryWarningHandler extends NSObject {
|
||||
public initWithCache(cache: NSCache<any, any>): MemmoryWarningHandler {
|
||||
this._cache = cache;
|
||||
|
||||
NSNotificationCenter.defaultCenter().addObserverSelectorNameObject(this, "clearCache", "UIApplicationDidReceiveMemoryWarningNotification", null);
|
||||
getter(NSNotificationCenter, NSNotificationCenter.defaultCenter).addObserverSelectorNameObject(this, "clearCache", "UIApplicationDidReceiveMemoryWarningNotification", null);
|
||||
if (trace.enabled) {
|
||||
trace.write("[MemmoryWarningHandler] Added low memory observer.", trace.categories.Debug);
|
||||
}
|
||||
@@ -41,7 +43,7 @@ class MemmoryWarningHandler extends NSObject {
|
||||
}
|
||||
|
||||
public dealloc(): void {
|
||||
NSNotificationCenter.defaultCenter().removeObserverNameObject(this, "UIApplicationDidReceiveMemoryWarningNotification", null);
|
||||
getter(NSNotificationCenter, NSNotificationCenter.defaultCenter).removeObserverNameObject(this, "UIApplicationDidReceiveMemoryWarningNotification", null);
|
||||
if (trace.enabled) {
|
||||
trace.write("[MemmoryWarningHandler] Removed low memory observer.", trace.categories.Debug);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user