Skip to content

Conversation

@macoley
Copy link
Contributor

@macoley macoley commented May 11, 2022

Warning: it's a breaking change!

New API for event dispatching.

✖️ old one:

const dispatch = useEvent()
dispatch('onBobPress', 'hello')

✅ new one:

const { onBobPress } = useEvent()
onBobPress('hello')

Credits: michaelp1987
Inspired by: https://www.reddit.com/r/reactjs/comments/umjjek/comment/i85iorr/?utm_source=share&utm_medium=web2x&context=3

@macoley macoley added the enhancement New feature or request label May 11, 2022
@macoley macoley added this to the 2.0.0 milestone May 11, 2022
@codecov-commenter
Copy link

codecov-commenter commented May 11, 2022

Codecov Report

Merging #5 (60c9be3) into main (8364f4d) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main        #5   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           38        39    +1     
  Branches         2         2           
=========================================
+ Hits            38        39    +1     
Impacted Files Coverage Δ
src/events.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8364f4d...60c9be3. Read the comment docs.

@macoley macoley merged commit d3846b7 into main May 11, 2022
@macoley macoley deleted the feat/simpler-dispatch branch May 11, 2022 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants