mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-19 09:30:36 +03:00
improve documentation
This commit is contained in:
@@ -47,7 +47,7 @@ I created this plugin because I hate ugly and space consuming scrollbars. Simila
|
|||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
### npm & Node
|
### npm & node
|
||||||
OverlayScrollbars can be downloaded from [npm](https://www.npmjs.com/package/overlayscrollbars) or the package manager of your choice:
|
OverlayScrollbars can be downloaded from [npm](https://www.npmjs.com/package/overlayscrollbars) or the package manager of your choice:
|
||||||
```sh
|
```sh
|
||||||
npm install overlayscrollbars
|
npm install overlayscrollbars
|
||||||
@@ -58,6 +58,8 @@ import 'overlayscrollbars/overlayscrollbars.css';
|
|||||||
import { OverlayScrollbars } from 'overlayscrollbars';
|
import { OverlayScrollbars } from 'overlayscrollbars';
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> __Note__: In older node versions use `'overlayscrollbars/styles/overlayscrollbars.css'` as the import path for the CSS file.
|
||||||
|
|
||||||
### Manual download & embedding
|
### Manual download & embedding
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
@@ -14,16 +14,16 @@ export type UseOverlayScrollbarsInstance = () => OverlayScrollbars | null;
|
|||||||
* @param events OverlayScrollbars events.
|
* @param events OverlayScrollbars events.
|
||||||
* @returns A tuple with two values:
|
* @returns A tuple with two values:
|
||||||
* The first value is the initialization function.
|
* The first value is the initialization function.
|
||||||
* The second value is an function which returns the current OverlayScrollbars instance or null if not initialized.
|
* The second value is a function which returns the current OverlayScrollbars instance or null if not initialized.
|
||||||
*/
|
*/
|
||||||
export const useOverlayScrollbars = (
|
export const useOverlayScrollbars = (
|
||||||
options?: PartialOptions,
|
options?: PartialOptions,
|
||||||
events?: EventListeners
|
events?: EventListeners
|
||||||
): [UseOverlayScrollbarsInitialization, UseOverlayScrollbarsInstance] => {
|
): [UseOverlayScrollbarsInitialization, UseOverlayScrollbarsInstance] => {
|
||||||
const osInstanceRef = useRef<OverlayScrollbars | null>(null);
|
const osInstanceRef = useRef<OverlayScrollbars | null>(null);
|
||||||
|
const offInitialEventsRef = useRef<(() => void) | void>();
|
||||||
const optionsRef = useRef<PartialOptions>();
|
const optionsRef = useRef<PartialOptions>();
|
||||||
const eventsRef = useRef<EventListeners>();
|
const eventsRef = useRef<EventListeners>();
|
||||||
const offInitialEventsRef = useRef<(() => void) | void>();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const { current: instance } = osInstanceRef;
|
const { current: instance } = osInstanceRef;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ I created this plugin because I hate ugly and space consuming scrollbars. Simila
|
|||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
### npm & Node
|
### npm & node
|
||||||
OverlayScrollbars can be downloaded from [npm](https://www.npmjs.com/package/overlayscrollbars) or the package manager of your choice:
|
OverlayScrollbars can be downloaded from [npm](https://www.npmjs.com/package/overlayscrollbars) or the package manager of your choice:
|
||||||
```sh
|
```sh
|
||||||
npm install overlayscrollbars
|
npm install overlayscrollbars
|
||||||
@@ -58,6 +58,8 @@ import 'overlayscrollbars/overlayscrollbars.css';
|
|||||||
import { OverlayScrollbars } from 'overlayscrollbars';
|
import { OverlayScrollbars } from 'overlayscrollbars';
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> __Note__: In older node versions use `'overlayscrollbars/styles/overlayscrollbars.css'` as the import path for the CSS file.
|
||||||
|
|
||||||
### Manual download & embedding
|
### Manual download & embedding
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
Reference in New Issue
Block a user