UNPKG

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
## πŸ“¦ 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