@solid-primitives/event-props
TypeScript icon, indicating that this package has built-in type declarations

0.2.7 • Public • Published

Solid Primitives Event Props

@solid-primitives/event-props

turborepo size size

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

Installation

npm install @solid-primitives/event-props
# or
yarn add @solid-primitives/event-props

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

TODO

Changelog

See CHANGELOG.md

Package Sidebar

Install

npm i @solid-primitives/event-props

Weekly Downloads

1,175

Version

0.2.7

License

MIT

Unpacked Size

7.62 kB

Total Files

8

Last publish

Collaborators

  • thetarnav.
  • lexlohr
  • davedbase