react-usespinner 1.0.13 → 1.0.14

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.
@@ -11,7 +11,6 @@ declare const useSpinner: (globalOptions?: Options) => {
11
11
  end: (name: string) => void;
12
12
  clear: () => void;
13
13
  busy: () => boolean;
14
- fetch: (...params: any) => Promise<unknown>;
15
14
  SpinnerContainer: ({ spinner, children }: SpinnerProps) => JSX.Element;
16
15
  };
17
16
  export default useSpinner;
@@ -42,36 +42,6 @@ var useSpinner = function (globalOptions) {
42
42
  var busy = function () {
43
43
  return actions && actions.length > 0;
44
44
  };
45
- var fetch = function () {
46
- var params = [];
47
- for (var _i = 0; _i < arguments.length; _i++) {
48
- params[_i] = arguments[_i];
49
- }
50
- var createUUID = function () {
51
- // https://www.arungudelli.com/tutorial/javascript/how-to-create-uuid-guid-in-javascript-with-examples/
52
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
53
- var r = Math.random() * 16 | 0, v = c === 'x' ? r : ((r & 0x3) | 0x8);
54
- return v.toString(16);
55
- });
56
- };
57
- var id = createUUID();
58
- console.log("Start fetch", id, params);
59
- start(id);
60
- return new Promise(function (resolve, reject) {
61
- var config = params[1] || {};
62
- fetch(params[0], config)
63
- .then(function (res) {
64
- resolve(res);
65
- })
66
- .catch(function (err) {
67
- reject(err);
68
- })
69
- .finally(function () {
70
- console.log("End fetch", id);
71
- end(id);
72
- });
73
- });
74
- };
75
45
  // JSX component used to wrap spinner of choice
76
46
  var SpinnerContainer = function (_a) {
77
47
  var spinner = _a.spinner, children = _a.children;
@@ -82,6 +52,6 @@ var useSpinner = function (globalOptions) {
82
52
  return (0, jsx_runtime_1.jsx)("div", { children: children });
83
53
  };
84
54
  // return hook values
85
- return { start: start, end: end, clear: clear, busy: busy, fetch: fetch, SpinnerContainer: SpinnerContainer };
55
+ return { start: start, end: end, clear: clear, busy: busy, SpinnerContainer: SpinnerContainer };
86
56
  };
87
57
  exports.default = useSpinner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-usespinner",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Track actions in progress to know if a spinner should be display. Actions expire within 10 seconds if not expired in code",
5
5
  "private": false,
6
6
  "license": "MIT",