## UserUtils
General purpose DOM/GreaseMonkey library that allows you to register listeners for when CSS selectors exist, intercept events, create persistent & synchronous data stores, modify the DOM more easily and much more.
Contains builtin TypeScript declarations. Supports ESM and CJS imports via a bundler and global declaration via `@require` or `
```
> [!NOTE]
> In order for your script not to break on a major library update, use one the versioned URLs above after replacing `INSERT_VERSION` with the desired version (e.g. `8.3.2`) or the versioned URL that's shown [at the top of the GreasyFork page.](https://greasyfork.org/scripts/472956-userutils)
- Then, access the functions on the global variable `UserUtils`:
```ts
UserUtils.addGlobalStyle("body { background-color: red; }");
// or using object destructuring:
const { clamp } = UserUtils;
console.log(clamp(1, 5, 10)); // 5
```
- If you're using TypeScript and it complains about the missing global variable `UserUtils`, install the library using the package manager of your choice and add the following inside any `.ts` file that is included in the final build:
```ts
declare const UserUtils: typeof import("@sv443-network/userutils");
declare global {
interface Window {
UserUtils: typeof UserUtils;
}
}
```
- If you're using a linter like ESLint, it might complain about the global variable `UserUtils` not being defined. To fix this, add the following to your ESLint configuration file:
```json
"globals": {
"UserUtils": "readonly"
}
```
## License:
This library is licensed under the MIT License.
See the [license file](./LICENSE.txt) for details.
Made with ❤️ by [Sv443](https://github.com/Sv443)
If you like this library, please consider [supporting the development](https://github.com/sponsors/Sv443)