hsu-utils 0.0.23 → 0.0.25

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.22
3
+ * hsu-utils v0.0.24
4
4
  *
5
5
  * some front-end utils
6
6
  *
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { GlobalWorkerOptions, getDocument } from 'pdfjs-dist/legacy/build/pdf.js';
11
- GlobalWorkerOptions.workerSrc = 'https://cdn.bootcss.com/pdf.js/2.13.216/pdf.worker.js';
11
+ GlobalWorkerOptions.workerSrc = 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/pdf.js/2.13.216/pdf.worker.js';
12
12
  const PDFMap = new Map();
13
13
  function load(pdfUrl) {
14
14
  return __awaiter(this, void 0, void 0, function* () {
@@ -22,7 +22,7 @@ function load(pdfUrl) {
22
22
  pdf = loadingTask.promise;
23
23
  PDFMap.set(pdfUrl, pdf);
24
24
  }
25
- return pdf;
25
+ return yield pdf;
26
26
  });
27
27
  }
28
28
  function getNumPages(pdfUrl) {
@@ -37,23 +37,27 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var pdf_js_1 = require("pdfjs-dist/legacy/build/pdf.js");
40
- pdf_js_1.GlobalWorkerOptions.workerSrc = 'https://cdn.bootcss.com/pdf.js/2.13.216/pdf.worker.js';
40
+ pdf_js_1.GlobalWorkerOptions.workerSrc = 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/pdf.js/2.13.216/pdf.worker.js';
41
41
  var PDFMap = new Map();
42
42
  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
- 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);
46
+ switch (_a.label) {
47
+ case 0:
48
+ pdf = PDFMap.get(pdfUrl);
49
+ if (!pdf) {
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
+ pdf = loadingTask.promise;
56
+ PDFMap.set(pdfUrl, pdf);
57
+ }
58
+ return [4, pdf];
59
+ case 1: return [2, _a.sent()];
55
60
  }
56
- return [2, pdf];
57
61
  });
58
62
  });
59
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hsu-utils",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "some front-end utils",
5
5
  "repository": "git@github.com:VitaTsui/hsu-utils.git",
6
6
  "author": "VitaHsu <vitahsu7@gmail.com>",