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

11.2.23 • Public • Published

@upradata/browser-util

Browser Utilities

A bunch of utilities in typescript working on Browser

Look at Node Utilities, for util stuff working only on Node

  • EventWrapperInRaf (wrap an event inside a requestAnimationFrame)
    const elementTarget = window;
    const eventName = 'scroll';
    const newEventName = eventName + 'InRaf';

    const scrollEvent: EventWrapperParam = {
        elementTarget, // this.el.nativeElement,
        source: {
            eventName,
            options: {} as boolean | AddEventListenerOptions
        },
        destination: {
            eventName: newEventName,
            debug: newEventName,
            getDetail: () => ({ ledetaildeouf: 'cool:)' })
        }
    };

    EventWrapperInRaf.create(scrollEvent);

    window.addEventListener(newEventName, event => console.log(event));

    // A cache creating to not create few time the same wrapper.

Readme

Keywords

Package Sidebar

Install

npm i @upradata/browser-util

Weekly Downloads

1

Version

11.2.23

License

MIT

Unpacked Size

64.3 kB

Total Files

45

Last publish

Collaborators

  • milottit