@uxland/browser-utilities
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

UXL Browser Utilities npm version

Build Status Statements Branches Functions Lines
BuildStatus Statements Branches Functions Lines

Installation

npm i @uxland/browser-utilities

Usage

Get browser's language

Returns language depending on user's navigator languages

getBrowserLang(); //=> 'ca'

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); //=> data:text/plain;base64,Zm9v

Browser's device

Returns true depending on device type

isTabletBrowser(); //=> true | false
isMobileBrowser(); //=> true | false
isMobileOrTabletBrowser(); //=> true | false

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); //=> 'task ended'
// To cancel asynchronous task
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); //=> 'Queue Executor' 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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.1-alpha.250alpha
1.0.1-alpha.120beta
1.0.257latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.257
1.0.10
1.0.1-alpha.250
1.0.1-alpha.240
1.0.1-alpha.230
1.0.1-alpha.210
1.0.1-alpha.200
1.0.1-alpha.190
1.0.1-alpha.180
1.0.1-alpha.170
1.0.1-alpha.160
1.0.1-alpha.150
1.0.1-alpha.140
1.0.1-alpha.130
1.0.1-alpha.120
1.0.1-alpha.110
1.0.1-alpha.100
1.0.1-alpha.90
1.0.1-alpha.80
1.0.1-alpha.70
1.0.1-alpha.61
1.0.1-alpha.50
1.0.1-alpha.40
1.0.1-alpha.30
1.0.1-alpha.21
1.0.1-alpha.10
1.0.1-alpha.00
1.0.00
1.0.0-alpha.40
1.0.0-alpha.30
1.0.0-alpha.20
1.0.0-alpha.10
1.0.0-alpha.00

Package Sidebar

Install

npm i @uxland/browser-utilities

Weekly Downloads

59

Version

1.0.2

License

BSD-4-Clause

Unpacked Size

54.1 kB

Total Files

34

Last publish

Collaborators

  • danielcabiscol
  • uxland-admin