| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -141,10 +141,7 @@ export class Cache extends observable.Observable implements definition.Cache { | |||
| 141 | 141 | public _onDownloadCompleted(key: string, image: any) { | |
| 142 | 142 | var request = <DownloadRequest>this._pendingDownloads[key]; | |
| 143 | 143 | ||
| 144 | - if (request.key && image) { | ||
| 145 | - this.set(request.key, image); | ||
| 146 | - } | ||
| 147 | - | ||
| 144 | + this.set(request.key, image); | ||
| 148 | 145 | this._currentDownloads--; | |
| 149 | 146 | ||
| 150 | 147 | if (request.completed) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,18 +46,18 @@ export class Cache extends common.Cache { | |||
| 46 | 46 | onComplete: function (result: any, context: any) { | |
| 47 | 47 | var instance = that.get(); | |
| 48 | 48 | if (instance) { | |
| 49 | - if (result && result != null) { | ||
| 50 | - instance._onDownloadCompleted(context, result); | ||
| 51 | - } else { | ||
| 52 | - instance._onDownloadError(context); | ||
| 53 | - } | ||
| 49 | + if (result) { | ||
| 50 | + instance._onDownloadCompleted(context, result); | ||
| 51 | + } else { | ||
| 52 | + instance._onDownloadError(context, new Error("No result in CompletionCallback")); | ||
| 53 | + } | ||
| 54 | 54 | } | |
| 55 | 55 | }, | |
| 56 | - onError: function (context: any) { | ||
| 57 | - var instance = that.get(); | ||
| 58 | - if (instance) { | ||
| 59 | - instance._onDownloadError(context); | ||
| 60 | - } | ||
| 56 | + onError: function (context: any, err: string) { | ||
| 57 | + var instance = that.get(); | ||
| 58 | + if (instance) { | ||
| 59 | + instance._onDownloadError(context, new Error(err)); | ||
| 60 | + } | ||
| 61 | 61 | } | |
| 62 | 62 | }); | |
| 63 | 63 | } | |
@@ -72,15 +72,13 @@ export class Cache extends common.Cache { | |||
| 72 | 72 | } | |
| 73 | 73 | ||
| 74 | 74 | public set(key: string, image: any): void { | |
| 75 | - try { | ||
| 76 | - if (key && key != null && image && image != null) { | ||
| 77 | - this._cache.put(key, image); | ||
| 78 | - } | ||
| 79 | - } catch (err) { | ||
| 80 | - if (trace.isEnabled()) { | ||
| 81 | - trace.write("Cache set error: " + err, trace.categories.Debug); | ||
| 75 | + try { | ||
| 76 | + if (key && image) { | ||
| 77 | + this._cache.put(key, image); | ||
| 78 | + } | ||
| 79 | + } catch (err) { | ||
| 80 | + trace.write("Cache set error: " + err, trace.categories.Error, trace.messageType.error); | ||
| 82 | 81 | } | |
| 83 | - } | ||
| 84 | 82 | } | |
| 85 | 83 | ||
| 86 | 84 | public remove(key: string): void { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments