@blat-js/helpers
v1.0.1
Published
Helpers
Downloads
102
Maintainers
Readme
@blat-js/helpers
Description
Just some bunch of useful functions. Moved it to a package just to stop copy and pasting them across projects
Installation
- Install the main package
npm install @blat-js/helpersUsage
| Name | Doc link | Description |
| ------------------ | ---------------------------------- | ------------------------------------------------------------------------------------------------------- |
| accurateSleep | link | Wait for provided duration (more precise than regular sleep) |
| AppEvent | link | Allows ypu to subscribe or emit any data that you need |
| BufferedAppEvent | link | Extended version of AppEvent. Store all unhandled emits in queue and fires them on first subscription |
| getBrowserTheme | link | To define if browser is in dark mode |
| getRandomInt | link | To simply get a random integer in provided (if needed) range |
| GlobalVariable | link | You can create a global variable, subscribe on it's updates. Use AppEvent under the hood |
| namedAppEvent | link | Almost the same with the AppEvent, but it separates events by string names. |
| round | link | To round a number to the provided precision |
| safeJsonParse | link | Allows you to ignore JSON.parse error and return a default value |
| sleep | link | Wait for provided duration |
Why
- To stop copy and pasting useful utils across projects
Status
Actively maintained
License
MIT
