UXL Browser Utilities ![npm version](https://badge.fury.io/js/%40uxland%2Fbrowser-utilities.svg)
Build Status | Statements | Branches | Functions | Lines |
---|
![Building Status BuildStatus](#buildstatus#) | ![Make me better! Statements](#statements#) | ![Make me better! Branches](#branches#) | ![Make me better! Functions](#functions#) | ![Make me better! Lines](#lines#) |
Installation
npm i @uxland/browser-utilities
Usage
Get browser's language
Returns language depending on user's navigator languages
getBrowserLang();
Meta
Display's meta information such as browser version, UA, LitElement version
displayMetaInformation();
Layout sizing
Display's layout sizing
displayLayoutSizing(true);
Convert file to base64
const file = new File(["foo"], "foo.txt", {
type: "text/plain",
});
await toBase64(file);
Browser's device
Returns true depending on device type
isTabletBrowser();
isMobileBrowser();
isMobileOrTabletBrowser();
Animation frame
Asynchronous task that will call provided callback in next window animation frame
const callback = () => console.log("task ended");
const handler = animationFrame.run(callback);
animationFrame.cancel(handler);
Asynchronous queue
Creates an asynchronous queue instance that will call provided function when possible
const executor = (...args: any[]) => console.log("Queue Executor", args);
const queue = new AsyncQueue(executor);
queue.enqueueItem(1);
Debouncer
https://polymer-library.polymer-project.org/3.0/api/utils/debounce
Idle Period
Micro task
https://polymer-library.polymer-project.org/3.0/api/utils/async
Time out
https://polymer-library.polymer-project.org/3.0/api/utils/async