A helpful primitive that creates the event props and a reactive store with the latest events
npm install @solid-primitives/event-props
# or
yarn add @solid-primitives/event-props
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>
TODO
See CHANGELOG.md