mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
fix: class name typo (#10364)
This commit is contained in:

committed by
GitHub

parent
fc172b3ea8
commit
f5f4666e04
@ -13,19 +13,19 @@ function ensureHttpRequest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NativeClass
|
@NativeClass
|
||||||
class MemmoryWarningHandler extends NSObject {
|
class MemoryWarningHandler extends NSObject {
|
||||||
static new(): MemmoryWarningHandler {
|
static new(): MemoryWarningHandler {
|
||||||
return <MemmoryWarningHandler>super.new();
|
return <MemoryWarningHandler>super.new();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _cache: NSCache<any, any>;
|
private _cache: NSCache<any, any>;
|
||||||
|
|
||||||
public initWithCache(cache: NSCache<any, any>): MemmoryWarningHandler {
|
public initWithCache(cache: NSCache<any, any>): MemoryWarningHandler {
|
||||||
this._cache = cache;
|
this._cache = cache;
|
||||||
|
|
||||||
NSNotificationCenter.defaultCenter.addObserverSelectorNameObject(this, 'clearCache', 'UIApplicationDidReceiveMemoryWarningNotification', null);
|
NSNotificationCenter.defaultCenter.addObserverSelectorNameObject(this, 'clearCache', 'UIApplicationDidReceiveMemoryWarningNotification', null);
|
||||||
if (Trace.isEnabled()) {
|
if (Trace.isEnabled()) {
|
||||||
Trace.write('[MemmoryWarningHandler] Added low memory observer.', Trace.categories.Debug);
|
Trace.write('[MemoryWarningHandler] Added low memory observer.', Trace.categories.Debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@ -34,14 +34,14 @@ class MemmoryWarningHandler extends NSObject {
|
|||||||
public dealloc(): void {
|
public dealloc(): void {
|
||||||
NSNotificationCenter.defaultCenter.removeObserverNameObject(this, 'UIApplicationDidReceiveMemoryWarningNotification', null);
|
NSNotificationCenter.defaultCenter.removeObserverNameObject(this, 'UIApplicationDidReceiveMemoryWarningNotification', null);
|
||||||
if (Trace.isEnabled()) {
|
if (Trace.isEnabled()) {
|
||||||
Trace.write('[MemmoryWarningHandler] Removed low memory observer.', Trace.categories.Debug);
|
Trace.write('[MemoryWarningHandler] Removed low memory observer.', Trace.categories.Debug);
|
||||||
}
|
}
|
||||||
super.dealloc();
|
super.dealloc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public clearCache(): void {
|
public clearCache(): void {
|
||||||
if (Trace.isEnabled()) {
|
if (Trace.isEnabled()) {
|
||||||
Trace.write('[MemmoryWarningHandler] Clearing Image Cache.', Trace.categories.Debug);
|
Trace.write('[MemoryWarningHandler] Clearing Image Cache.', Trace.categories.Debug);
|
||||||
}
|
}
|
||||||
this._cache.removeAllObjects();
|
this._cache.removeAllObjects();
|
||||||
utils.GC();
|
utils.GC();
|
||||||
@ -56,14 +56,14 @@ export class Cache extends common.Cache {
|
|||||||
private _cache: NSCache<any, any>;
|
private _cache: NSCache<any, any>;
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
private _memoryWarningHandler: MemmoryWarningHandler;
|
private _memoryWarningHandler: MemoryWarningHandler;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this._cache = new NSCache<any, any>();
|
this._cache = new NSCache<any, any>();
|
||||||
|
|
||||||
this._memoryWarningHandler = MemmoryWarningHandler.new().initWithCache(this._cache);
|
this._memoryWarningHandler = MemoryWarningHandler.new().initWithCache(this._cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
public _downloadCore(request: common.DownloadRequest) {
|
public _downloadCore(request: common.DownloadRequest) {
|
||||||
|
Reference in New Issue
Block a user