Skip to content

Commit

Permalink
ref: separate docs file (#71) & edit links
Browse files Browse the repository at this point in the history
  • Loading branch information
Sv443 committed Jan 22, 2025
1 parent e95d835 commit 962e8cd
Show file tree
Hide file tree
Showing 7 changed files with 3,233 additions and 3,130 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@
- separate instances can have different MutationObserver options set to further reduce performance impact
- the separation into instances allows for a new "chaining" paradigm where selector listeners are only added and checked for once they are actually needed (see examples in the documentation)
- when using chaining, separate instances can be created and have listeners added to them before their base element is available in the DOM tree
- every listener can have a set debounce time, so that it doesn't get called too often (works the same as the [`debounce()` function](https://github.com/Sv443-Network/UserUtils/blob/main/README.md#debounce), but is disabled by default)
- every listener can have a set debounce time, so that it doesn't get called too often (works the same as the [`debounce()` function](https://github.com/Sv443-Network/UserUtils/blob/v3.0.0/README.md#debounce), but is disabled by default)
- there are now multiple methods to get and delete specific listeners

The `SelectorObserver.addListener()` method is backwards compatible with the old `onSelector()` function, so you can just add the class instance in front (for full backwards compat use `document.body` for the `baseElement` parameter of the constructor), then change the old function's name and it should work as before.
For more info and examples, please view the [SelectorObserver documentation](https://github.com/Sv443-Network/UserUtils/blob/main/README.md#selectorobserver)
For more info and examples, please view the [SelectorObserver documentation](https://github.com/Sv443-Network/UserUtils/blob/v3.0.0/README.md#selectorobserver)

### Minor Changes

Expand Down
131 changes: 73 additions & 58 deletions README-summary.md

Large diffs are not rendered by default.

3,136 changes: 71 additions & 3,065 deletions README.md

Large diffs are not rendered by default.

3,080 changes: 3,080 additions & 0 deletions docs.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
"dist/index.js",
"dist/index.cjs",
"dist/index.global.js",
"dist/index.umd.js",
"dist/lib/**/*.d.ts",
"package.json",
"README.md",
"README-summary.md",
"CHANGELOG.md",
"LICENSE.txt"
]
Expand Down
6 changes: 3 additions & 3 deletions lib/Debouncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NanoEmitter } from "./NanoEmitter.js";
//#region types

/**
* The type of edge to use for the debouncer - [see the docs for a diagram and explanation.](https://github.com/Sv443-Network/UserUtils/blob/main/README.md#debouncer)
* The type of edge to use for the debouncer - [see the docs for a diagram and explanation.](https://github.com/Sv443-Network/UserUtils/blob/main/docs.md#debouncer)
* - `immediate` - (default & recommended) - calls the listeners at the very first call ("rising" edge) and queues the latest call until the timeout expires
* - Pros:
* - First call is let through immediately
Expand Down Expand Up @@ -52,7 +52,7 @@ export class Debouncer<TArgs> extends NanoEmitter<DebouncerEventMap<TArgs>> {
/**
* Creates a new debouncer with the specified timeout and edge type.
* @param timeout Timeout in milliseconds between letting through calls - defaults to 200
* @param type The edge type to use for the debouncer - see {@linkcode DebouncerType} for details or [the documentation for an explanation and diagram](https://github.com/Sv443-Network/UserUtils/blob/main/README.md#debouncer) - defaults to "immediate"
* @param type The edge type to use for the debouncer - see {@linkcode DebouncerType} for details or [the documentation for an explanation and diagram](https://github.com/Sv443-Network/UserUtils/blob/main/docs.md#debouncer) - defaults to "immediate"
*/
constructor(protected timeout = 200, protected type: DebouncerType = "immediate") {
super();
Expand Down Expand Up @@ -161,7 +161,7 @@ export class Debouncer<TArgs> extends NanoEmitter<DebouncerEventMap<TArgs>> {
* The returned function can be called with any arguments and will execute the `call()` method of the debouncer.
* The debouncer instance is accessible via the `debouncer` property of the returned function.
*
* Refer to the {@linkcode Debouncer} class definition or the [Debouncer documentation](https://github.com/Sv443-Network/UserUtils/blob/main/README.md#debouncer) for more information.
* Refer to the {@linkcode Debouncer} class definition or the [Debouncer documentation](https://github.com/Sv443-Network/UserUtils/blob/main/docs.md#debouncer) for more information.
*/
export function debounce<
TFunc extends DebouncerFunc<TArgs>,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@
"/dist/index.cjs",
"/dist/index.mjs",
"/dist/index.global.js",
"/dist/index.umd.js",
"/dist/lib/**.d.ts",
"/package.json",
"/README.md",
"/README-summary.md",
"/CHANGELOG.md",
"/LICENSE.txt"
]
Expand Down

0 comments on commit 962e8cd

Please sign in to comment.