Skip to content

Commit dded5b5

Browse files
committed
minor changes
1 parent d4f5168 commit dded5b5

5 files changed

Lines changed: 21 additions & 24 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ const App = () => {
123123
124124
| Methods | Parameters | Descriptions |
125125
| ------------------------------------------- | :---------------------------------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
126-
| increase(value) | Number | Adds a value to the loading indicator. |
127-
| decrease(value) | Number | Decreases a value to the loading indicator. |
128126
| start(loaderType?) | `continuous` (default) or `static` | Starts the loading indicator. If type is "static" it will start the static bar otherwise it will start the animated continuous bar. |
129127
| continuousStart(startingValue, refreshRate) | Number (optional), Number(optional) | Starts the loading indicator with a random starting value between 20-30, then repetitively after an refreshRate, increases it by a random value between 2-10. This continues until it reaches 90% of the indicator's width. |
130128
| staticStart(startingValue) | Number (optional) | Starts the loading indicator with a random starting value between 30-50. |
131129
| complete() | | Makes the loading indicator reach 100% of his width and then fade. |
130+
| increase(value) | Number | Adds a value to the loading indicator. |
131+
| decrease(value) | Number | Decreases a value to the loading indicator. |
132132
| getProgress() | | Get the current progress value. |
133133
134134
## Properties

example/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useRef, RefObject } from "react";
1+
import React, { useState, useRef } from "react";
22
import { Light as SyntaxHighlighter } from "react-syntax-highlighter";
33
import js from "react-syntax-highlighter/dist/esm/languages/hljs/javascript";
44
import atom from "react-syntax-highlighter/dist/esm/styles/hljs/atom-one-dark";
@@ -14,7 +14,7 @@ const App: React.FC = () => {
1414
const [progress, setProgress] = useState<number>(0);
1515
const [barColor, setBarColor] = useState<string>("#f11946");
1616
const [buttonsColor, setButtonsColor] = useState<string>("red");
17-
const ref: RefObject<LoadingBarRef> = useRef(null);
17+
const ref = useRef<LoadingBarRef>(null);
1818
const [usingRef, setUsingRef] = useState<boolean>(true);
1919
const [usingHooks, setUsingHooks] = useState<boolean>(true);
2020

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
"build": "tsup",
2626
"dev": "tsup --watch",
2727
"prepublishOnly": "npm run build",
28-
"test": "run-s test:unit test:lint test:build",
2928
"test:build": "npm run build",
3029
"predeploy": "cd example && npm install && npm run build",
31-
"deploy": "gh-pages -d example/build"
30+
"deploy": "gh-pages -d example/dist"
3231
},
3332
"peerDependencies": {
3433
"react": "^16 || ^17 || ^18 || ^19"

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,4 +419,4 @@ export const useLoadingBar = (props: IProps): Omit<IContext, "setProps"> => {
419419
};
420420
};
421421

422-
export default LoadingBar;
422+
export { LoadingBar as default };

src/useInterval.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1-
import { useEffect, useRef } from 'react'
1+
import { useEffect, useRef } from "react";
22

33
/** keep typescript happy */
4-
const noop = () => {}
4+
const noop = () => {};
55

66
export function useInterval(
77
callback: () => void,
88
delay: number | null | false,
9-
immediate?: boolean
9+
immediate?: boolean,
1010
) {
11-
const savedCallback = useRef(noop)
11+
const savedCallback = useRef(noop);
1212

1313
// Remember the latest callback.
1414
useEffect(() => {
15-
savedCallback.current = callback
16-
})
15+
savedCallback.current = callback;
16+
});
1717

1818
// Execute callback if immediate is set.
1919
useEffect(() => {
20-
if (!immediate) return
21-
if (delay === null || delay === false) return
22-
savedCallback.current()
23-
}, [immediate])
20+
if (!immediate) return;
21+
if (delay === null || delay === false) return;
22+
savedCallback.current();
23+
}, [immediate]);
2424

2525
// Set up the interval.
2626
useEffect(() => {
27-
if (delay === null || delay === false) return undefined
28-
const tick = () => savedCallback.current()
29-
const id = setInterval(tick, delay)
30-
return () => clearInterval(id)
31-
}, [delay])
27+
if (delay === null || delay === false) return undefined;
28+
const tick = () => savedCallback.current();
29+
const id = setInterval(tick, delay);
30+
return () => clearInterval(id);
31+
}, [delay]);
3232
}
33-
34-
export default useInterval

0 commit comments

Comments
 (0)