pixuireactcomponents 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -89,13 +89,21 @@ export var assetCache;
|
|
|
89
89
|
xhr.open('GET', url, true);
|
|
90
90
|
xhr.responseType = 'arraybuffer';
|
|
91
91
|
xhr.onload = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
92
|
+
var res;
|
|
92
93
|
return __generator(this, function (_a) {
|
|
93
94
|
if (xhr.status === 200) {
|
|
94
95
|
console.log('cacheAsset xhr statue=200', url, localPath);
|
|
95
96
|
// let buf = Buffer.from(xhr.response, 'binary').buffer;
|
|
96
97
|
if (localPath) {
|
|
97
|
-
OPLib.saveToFile(localPath, xhr.response);
|
|
98
|
-
|
|
98
|
+
res = OPLib.saveToFile(localPath, xhr.response);
|
|
99
|
+
if (res === 0) {
|
|
100
|
+
console.log('cacheAsset saveToFile success, res', res, localPath);
|
|
101
|
+
resolve(localPath);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
console.warn('cacheAsset saveToFile failed, res', res, localPath);
|
|
105
|
+
reject(url);
|
|
106
|
+
}
|
|
99
107
|
return [2 /*return*/];
|
|
100
108
|
}
|
|
101
109
|
else {
|