@rootreeweb/js-lib
v4.0.18
Published
A collection of useful JavaScript functions
Readme
@rootreeweb/js-lib
What is This?
The Rootree JS Library is a library of commonly used functions in JavaScript and TypeScript applications. It provides functions for working with dates, the DOM, and more.
Installation
Make sure that your device is set up to use the
@rootreewebnpm registry. More details on how to do this can be found on the Rootree Web Wiki.Install the package
yarn add @rootreeweb/rt-js-libImport the required functions into your script. For example, if you wanted to use the ready function to display a message when the page is fully loaded, you would write:
import { ready } from "@rootreeweb/rt-js-lib"; ready(() => console.log("I'm ready!"));
Functions
Here are some functions that are available in the library:
- removeChildren(element: Element)
- setPropertyOnSelector( selector: string, property: keyof T, value: T[keyof T] )
- ready(callback: () => unknown)
- waitFor( containerSelector: string, waitingForSelector: string, callback: () => void, runOnce = false )
- download(filename: string, text: string)
- downloadBinary(filename: string, binary: ArrayBuffer)
- getDayNames(format: "long" | "short" | "narrow")
- and many more!
