FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

refactor(image-cache): updates for iOS · NativeScript/NativeScript@2097262 · GitHub

Commit 2097262

Browse files
committed
refactor(image-cache): updates for iOS
Use arrow functions. Remove an unnecessary `trace.write().
1 parent 5e314aa commit 2097262

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

‎tns-core-modules/ui/image-cache/image-cache.ios.ts‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class Cache extends common.Cache {
7373
super();
7474

7575
this._cache = new NSCache<any, any>();
76-
76+
7777
//this._delegate = NSCacheDelegateImpl.new();
7878
//this._cache.delegate = this._delegate;
7979

@@ -83,20 +83,16 @@ export class Cache extends common.Cache {
8383
public _downloadCore(request: common.DownloadRequest) {
8484
ensureHttpRequest();
8585

86-
var that = this;
8786
httpRequest.request({ url: request.url, method: "GET" })
88-
.then(response => {
89-
try {
90-
var image = UIImage.alloc().initWithData(response.content.raw);
91-
that._onDownloadCompleted(request.key, image);
92-
} catch (err) {
93-
that._onDownloadError(request.key);
94-
}
95-
}, function(err) {
96-
that._onDownloadError(request.key);
97-
if (trace.isEnabled()) {
98-
trace.write("request error: " + err, trace.categories.Debug);
99-
}
87+
.then((response) => {
88+
try {
89+
var image = UIImage.alloc().initWithData(response.content.raw);
90+
this._onDownloadCompleted(request.key, image);
91+
} catch (err) {
92+
this._onDownloadError(request.key, err);
93+
}
94+
}, (err) => {
95+
this._onDownloadError(request.key, err);
10096
});
10197
}
10298

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL