@lemon-fe/hooks 0.0.30 → 0.0.33

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.
@@ -1,3 +1,7 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
+
3
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
+
1
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
6
 
3
7
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -35,7 +39,27 @@ export default function usePreload(opts, deps) {
35
39
  _onSuccess = opts.onSuccess;
36
40
  }
37
41
 
38
- var _useRequest = useRequest(request, {
42
+ var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
43
+ var res;
44
+ return regeneratorRuntime.wrap(function _callee$(_context) {
45
+ while (1) {
46
+ switch (_context.prev = _context.next) {
47
+ case 0:
48
+ _context.next = 2;
49
+ return request();
50
+
51
+ case 2:
52
+ res = _context.sent;
53
+ setData(null);
54
+ return _context.abrupt("return", res);
55
+
56
+ case 5:
57
+ case "end":
58
+ return _context.stop();
59
+ }
60
+ }
61
+ }, _callee);
62
+ })), {
39
63
  onSuccess: function onSuccess(res) {
40
64
  if (_onSuccess) {
41
65
  _onSuccess(res);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/hooks",
3
- "version": "0.0.30",
3
+ "version": "0.0.33",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -23,5 +23,5 @@
23
23
  "devDependencies": {
24
24
  "@types/color-string": "^1.5.2"
25
25
  },
26
- "gitHead": "3a34787932464bfcc5dbfac8956ba99b06b96ff7"
26
+ "gitHead": "e4fcdb61ddac26d16a72ad7b9339099d087cc13e"
27
27
  }