0.2.7 • Published 3 months ago

@solid-primitives/event-props v0.2.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@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

0.2.7

3 months ago

0.2.6

4 months ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.150

2 years ago

0.0.100

2 years ago