Event Props

NPM
v0.2.7

#Installation

npm install @solid-primitives/event-props
yarn add @solid-primitives/event-props
pnpm add @solid-primitives/event-props

#Readme

A helpful primitive that creates the event props and a reactive store with the latest events

#How to use it

#createEventProps

Receive the event props and a props with the latest events:

const [events, eventProps] = createEventProps('mousedown', 'mousemove', 'mouseup');

const isMouseDown = createMemo(() => (events.mousedown?.ts ?? 0) > (events.mouseup?.ts ?? 1));

createEffect(() => {
  if (isMouseDown()) {
    console.log(events.mousemove?.clientX, events.mousemove?.clientY);
  }
})

<div {...eventProps}>Click and drag on me</div>

#Demo

Live Site

TODO

#Changelog

See CHANGELOG.md