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

joievents

v1.0.16

Published

*compose events like a native!*

Downloads

23

Readme

JoiEvents

compose events like a native!

Read the book and enjoi!

Vocabulary

  • OS Event: something happening in the browser. DOM Events being dispatched is an event, of course, but a callback triggered or native system task executed are also generally speaking an event.
  • Event: a DOM event that is either triggered by an OS Event or dispatched by a JS script.
  • Global events begin their propagation on the window object (capture phase). Global events commonly have {bubble: true, composed: true}, but they can also be dispatched directly on the window object.
  • Local events are all events that do not begin their propagation on the window (capture phase).
  • Native events are created by the browser.
  • Custom events are created by a script.
  • Preceding event propagates before another event.
  • Trailing event propagates after another event.
  • Composed event is triggered by one or more other events.
  • Trigger event is an event that initiates a new composed event.
  • Atomic event is not triggered by any other events, but something else.
  • Event sequence: a series of ordered trigger events that combine to dispatch a composed event.
  • Event listener: a JS function that is triggered by the occurrence of an event.
  • defaultAction: a native function built into the browser that is triggered when an event completes propagation.
  • Composed event function: a group of functions that together implement a composed event.
  • Trigger function: one of many event listener functions that make up a composed event function. Trigger functions capture events, processes them, and most often dispatch a new composed event.
  • Initial trigger function: a trigger function that initiates a composed event sequence and can register a group of secondary trigger functions for other events. The initial trigger functions are active when the composed event function is listening and not yet activated, and the initial trigger functions activate the composed event function. Initial trigger functions are commonly added to the document in the capture phase.
  • Secondary trigger function: trigger functions that are activated when a composed event function is activated, and deactivated when the composed event function is deactivated. Secondary trigger functions are commonly added to the window in the capture phase.

Introduction

  1. HowTo: Compose Events
  2. HowTo: Combine Events and JS
  3. HowTo: Combine Events and HTML
  4. HowTo: Combine Events and CSS

Event to event composition

  1. HowTo: Listen
  2. Intro: EventComposition
  3. WhatIs: propagation
  4. HowTo: StopPropagation
  5. Pattern: CancelClick
  6. Pattern: EarlyBird
  7. Pattern: PriorEvent
  8. Pattern: AfterthoughtEvent
  9. Pattern: ReplaceDefaultAction
  10. Problem: PayAttention
  11. Pattern: ReverseGlobalization

Event translation

  1. Pattern: AttributeFilteredEvent
  2. Pattern: TypeFilteredEvent
  3. Pattern: DetailsOnDemand
  4. Event: link-click
  5. Pattern: SpecializedEventInterface
  6. Pattern: MergedEvents

EventSequence patterns

  1. Pattern: TakeNote
  2. Pattern: PayAttention
  3. Pattern: ListenUp
  4. Pattern: EventAttribute
  5. Pattern: MarkMyValues
  6. Pattern: ShowGestureState (todo)
  7. Pattern: DebounceEvents (todo)

Gestures: mouse

  1. HowTo: drag'n'drop
  2. Pattern: InvadeAndRetreat
  3. Pattern: GrabTarget
  4. Pattern: GrabMouse
  5. Pattern: MouseMoveTrap
  6. Pattern: MouseDoubleDown
  7. Pattern: AlertBlurCall
  8. Event: long-press
  9. Event: mouse dragging

Gestures: touch

  1. Problem: SloppyFingers
  2. Problem: GestureStuttering
  3. Pattern: TouchendPreventDefault
  4. Problem: ConflictingGestures
  5. Problem: CoarseSensors
  6. Pattern: PassiveAggressiveTouchstart
  7. Pattern: GrabTouch
  8. Problem: WebDemocracy (todo)
  9. Anti-pattern: RejectionBuildup (todo)
  10. Event: touch dragging
  11. Event: swipe
  12. Event: pinch & .spin()

Routing

  1. todo add navigation control freak
  2. todo add the patterns on hash-based routing
  3. todo add the patterns on slash-based routing
  4. todo move in from chapter on translate events
  5. https://instant.page/ try to use an event listener for mousemove that detects when the mouse cursor slows down over an element.

todo

  1. fix the different long-press events so they are source code.

Personal comment

I was surprised to find how rarely EventComposition is used. It made me second guess my self. And, while I pursue these second guesses, I became even more surprised.

First, many native events follow the EventComposition pattern. Through its actions, the platform advocates for this pattern, implicitly, but strongly.

Second, pursuing this pattern reveals several flaws in other approaches and several large benefits for EventComposition:

  • extreme ease of reuse, both across apps and within apps;
  • extremely low coupling to other parts of the code;
  • super clear interfaces yielding less confusion, misuse and general anxiety;
  • and lightDOM composeability, ie. you can combine events from the same vantage point as you can native elements.

Yet, for some reason, few use this approach! Why is that? I really don't know. ¯\_(ツ)_/¯

Test

Test 2