tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
33 lines (21 loc) β’ 1.62 kB
Markdown
## π¦ Tiny updates time!
Tiny big upgrade incoming! This release brings **new utilities**!
### β¨ New Features
* **π `TinyNotifications`**
A utility class to manage browser notifications with sound, custom icons, text truncation, and click behavior.
* **βοΈ `safeTextTrim(text, limit)`**
Trims a text string to a specified character limit, attempting to avoid cutting words in half. If a space is found before the limit and itβs not too far from the limit (at least a fraction controlled by `safeCutZone`), the cut is made at that space; otherwise, the text is hard-cut at the limit. If the input text is shorter than or equal to the limit, it is returned unchanged.
* **π `readFileBlob(file, method)`**
A helper to read files using any `FileReader` method (`readAsText`, `readAsDataURL`, etc.).
Easy Promise-based file access.
* **𧬠`readBase64Blob(base64Data, mimeType)`**
Reads a file and returns its Base64 content using the FileReader API, with optional formatting as a full Data URL.
### π§ Enhancements
* **π§Ώ `installWindowHiddenScript()` now supports callbacks**
You can now hook into visibility change events (e.g. when the tab is hidden or regained focus) with custom behavior.
* **π `fetchJson()` now accepts arrays**
A bug was fixed where `Array` values werenβt properly serialized.
Arrays are now sent safely via JSON body β glitch resolved β
### π οΈ Documentation
* Updated JSDocs across all new methods and adjusted the internal style for consistency.
**Full Changelog**: https://github.com/JasminDreasond/Tiny-Essentials/compare/1.13.2...1.14.0