npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@st-lib/events

v1.0.2

Published

Tool library for easy binding events.

Downloads

2

Readme

Tool library for easy binding events.

ESNext module, please use webpack / rollup / parcel / etc.

Procedure style add event listener.

Returns listener remove function.

export declare function addEventListener<K extends keyof HTMLElementEventMap>(target: EventTarget, type: K, listener: (event: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): () => void;
export declare function addEventListener<K extends keyof HTMLBodyElementEventMap>(target: EventTarget, type: K, listener: (event: HTMLBodyElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): () => void;
export declare function addEventListener<K extends keyof HTMLMediaElementEventMap>(target: EventTarget, type: K, listener: (event: HTMLMediaElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): () => void;
export declare function addEventListener<K extends keyof HTMLMarqueeElementEventMap>(target: EventTarget, type: K, listener: (event: HTMLMarqueeElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): () => void;
export declare function addEventListener<K extends keyof HTMLFrameSetElementEventMap>(target: EventTarget, type: K, listener: (event: HTMLFrameSetElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): () => void;
export declare function addEventListener<K extends keyof SVGElementEventMap>(target: EventTarget, type: K, listener: (event: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): () => void;
export declare function addEventListener<K extends keyof SVGSVGElementEventMap>(target: EventTarget, type: K, listener: (event: SVGSVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): () => void;
export declare function addEventListener<K extends string, E = Event>(target: EventTarget, type: K, listener: (event: E) => any, options?: boolean | AddEventListenerOptions): () => void;

Functional style event listener creation.

export declare function createEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (event: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): (target: EventTarget) => () => void
export declare function createEventListener<K extends keyof HTMLBodyElementEventMap>(type: K, listener: (event: HTMLBodyElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): (target: EventTarget) => () => void
export declare function createEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (event: HTMLMediaElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): (target: EventTarget) => () => void
export declare function createEventListener<K extends keyof HTMLMarqueeElementEventMap>(type: K, listener: (event: HTMLMarqueeElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): (target: EventTarget) => () => void
export declare function createEventListener<K extends keyof HTMLFrameSetElementEventMap>(type: K, listener: (event: HTMLFrameSetElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): (target: EventTarget) => () => void
export declare function createEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (event: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): (target: EventTarget) => () => void
export declare function createEventListener<K extends keyof SVGSVGElementEventMap>(type: K, listener: (event: SVGSVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): (target: EventTarget) => () => void
export declare function createEventListener<K extends string, E = Event>(type: K, listener: (event: E) => any, options?: boolean | AddEventListenerOptions): (target: EventTarget) => () => void

Special event listener creation.

  1. batch event binding

    export declare function createEventMapListener(inp: HTMLEventLisenerMap & SVGEventListenerMap & Record<string, EventListenerMapValue<any>>): (target: EventTarget) => () => void
  2. input value changed

    export declare function createValueChangeEventListener(listener: (event: Event | InputEvent) => any, options?: boolean | AddEventListenerOptions): (target: EventTarget) => () => void

Well known event listener creators.

export declare const createSvgUnloadEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createSvgZoomEventListener: (listener: (event: SVGZoomEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createAbortEventListener: (listener: (event: UIEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createAfterPrintEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createAnimationCancelEventListener: (listener: (event: AnimationEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createAnimationEndEventListener: (listener: (event: AnimationEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createAnimationIterationEventListener: (listener: (event: AnimationEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createAnimationStartEventListener: (listener: (event: AnimationEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createAuxClickEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createBeforePrintEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createBeforeUnloadEventListener: (listener: (event: BeforeUnloadEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createBlurEventListener: (listener: (event: FocusEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createBounceEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createCancelEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createCanPlayEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createCanPlayThroughEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createChangeEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createClickEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createCloseEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createContextMenuEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createCopyEventListener: (listener: (event: ClipboardEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createCueChangeEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createCutEventListener: (listener: (event: ClipboardEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDblClickEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDragEventListener: (listener: (event: DragEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDragEndEventListener: (listener: (event: DragEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDragEnterEventListener: (listener: (event: DragEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDragExitEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDragLeaveEventListener: (listener: (event: DragEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDragoverEventListener: (listener: (event: DragEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDragStartEventListener: (listener: (event: DragEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDropEventListener: (listener: (event: DragEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createDurationChangeEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createEmptiedEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createEncryptedEventListener: (listener: (event: MediaEncryptedEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createEndedEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createErrorEventListener: (listener: (event: ErrorEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createFinishEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createFocusEventListener: (listener: (event: FocusEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createFocusInEventListener: (listener: (event: FocusEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createFocusOutEventListener: (listener: (event: FocusEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createFullscreenChangeEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createFullscreenErrorEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createGotPointerCaptureEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createHashChangeEventListener: (listener: (event: HashChangeEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createInputEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createInvalidEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createKeyDownEventListener: (listener: (event: KeyboardEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createKeyPressEventListener: (listener: (event: KeyboardEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createKeyUpEventListener: (listener: (event: KeyboardEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createLanguageChangeEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createLoadEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createLoadedDataEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createLoadedMetadataEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createLoadStartEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createLostPointerCaptureEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createMessageEventListener: (listener: (event: MessageEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createMessageErrorEventListener: (listener: (event: MessageEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createMouseDownEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createMouseEnterEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createMouseLeaveEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createMouseMoveEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createMouseOutEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createMouseOverEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createMouseUpEventListener: (listener: (event: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createOfflineEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createOnlineEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createOrientationChangeEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPageHideEventListener: (listener: (event: PageTransitionEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPageShowEventListener: (listener: (event: PageTransitionEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPasteEventListener: (listener: (event: ClipboardEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPauseEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPlayEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPlayingEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPointerCancelEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPointerDownEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPointerEnterEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPointerLeaveEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPointerMoveEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPointerOutEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPointeroverEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPointerUpEventListener: (listener: (event: PointerEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createPopStateEventListener: (listener: (event: PopStateEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createProgressEventListener: (listener: (event: ProgressEvent<EventTarget>) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createRateChangeEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createRejectionHandledEventListener: (listener: (event: PromiseRejectionEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createResetEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createResizeEventListener: (listener: (event: UIEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createScrollEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createSecurityPolicyViolationEventListener: (listener: (event: SecurityPolicyViolationEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createSeekedEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createSeekingEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createSelectEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createSelectionChangeEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createSelectStartEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createStalledEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createStartEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createStorageEventListener: (listener: (event: StorageEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createSubmitEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createSuspendEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createTimeupdateEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createToggleEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createTouchCancelEventListener: (listener: (event: TouchEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createTouchEndEventListener: (listener: (event: TouchEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createTouchMoveEventListener: (listener: (event: TouchEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createTouchStartEventListener: (listener: (event: TouchEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createTransitionCancelEventListener: (listener: (event: TransitionEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createTransitionEndEventListener: (listener: (event: TransitionEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createTransitionRunEventListener: (listener: (event: TransitionEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createTransitionStartEventListener: (listener: (event: TransitionEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createUnhandledRejectionEventListener: (listener: (event: PromiseRejectionEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createUnloadEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createVolumeChangeEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createWaitingEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createWaitingForKeyEventListener: (listener: (event: Event) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void
export declare const createWheelEventListener: (listener: (event: WheelEvent) => any, options?: boolean | AddEventListenerOptions | undefined) => (target: EventTarget) => () => void