0.3.1 • Published 2 months ago

@solid-primitives/event-props v0.3.1

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

@solid-primitives/event-props

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.3.0

5 months ago

0.3.1

2 months ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.150

4 years ago

0.0.100

4 years ago