hsu-utils 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * hsu-utils v0.0.21
3
+ * hsu-utils v0.0.22
4
4
  *
5
5
  * some front-end utils
6
6
  *
@@ -19,7 +19,7 @@ function load(pdfUrl) {
19
19
  cMapUrl: 'https://unpkg.com/browse/pdfjs-dist@2.13.216/cmaps/',
20
20
  cMapPacked: true
21
21
  });
22
- pdf = yield loadingTask.promise;
22
+ pdf = loadingTask.promise;
23
23
  PDFMap.set(pdfUrl, pdf);
24
24
  }
25
25
  return pdf;
@@ -43,22 +43,17 @@ function load(pdfUrl) {
43
43
  return __awaiter(this, void 0, void 0, function () {
44
44
  var pdf, loadingTask;
45
45
  return __generator(this, function (_a) {
46
- switch (_a.label) {
47
- case 0:
48
- pdf = PDFMap.get(pdfUrl);
49
- if (!!pdf) return [3, 2];
50
- loadingTask = (0, pdf_js_1.getDocument)({
51
- url: pdfUrl,
52
- cMapUrl: 'https://unpkg.com/browse/pdfjs-dist@2.13.216/cmaps/',
53
- cMapPacked: true
54
- });
55
- return [4, loadingTask.promise];
56
- case 1:
57
- pdf = _a.sent();
58
- PDFMap.set(pdfUrl, pdf);
59
- _a.label = 2;
60
- case 2: return [2, pdf];
46
+ pdf = PDFMap.get(pdfUrl);
47
+ if (!pdf) {
48
+ loadingTask = (0, pdf_js_1.getDocument)({
49
+ url: pdfUrl,
50
+ cMapUrl: 'https://unpkg.com/browse/pdfjs-dist@2.13.216/cmaps/',
51
+ cMapPacked: true
52
+ });
53
+ pdf = loadingTask.promise;
54
+ PDFMap.set(pdfUrl, pdf);
61
55
  }
56
+ return [2, pdf];
62
57
  });
63
58
  });
64
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hsu-utils",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "some front-end utils",
5
5
  "repository": "git@github.com:VitaTsui/hsu-utils.git",
6
6
  "author": "VitaHsu <vitahsu7@gmail.com>",