Skip to content

Conversation

@nnelgxorz
Copy link
Contributor

@nnelgxorz nnelgxorz commented Jul 25, 2022

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests

Description

Adds autocompletions for host:on, document:on, window:on and preventDefault: attributes.

Use cases and why

    1. Improves developer experience by exposing autocompletions.
    1. DRYs up event handler code. Add events to the QwikEventMap and all types are automatically generated.

Checklist:

  • My code follows the developer guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • Added new tests to cover the fix / functionality

'document:onVisible'?: QRL<(event: Event, el: Element) => any>;

'document:onVisibilityChange$'?: (event: Event, el: Element) => any;
'document:onVisibilityChangeQrl'?: QRL<(event: Event, el: Element) => any>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify, remove both of these events or just the Qrl variant?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Qrl variant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Also, document:onLoad$ and document:onScroll$ should already be generated from the new types. Should I delete those too?

@manucorporat
Copy link
Contributor

Love this PR! lets get it done and merge!

@nnelgxorz nnelgxorz marked this pull request as ready for review July 25, 2022 18:49
@manucorporat
Copy link
Contributor

Havent tested this change, but i am worried about the autocompletion of events, like this:
Screenshot 2022-07-26 at 10 44 45

is that still working?

@nnelgxorz
Copy link
Contributor Author

Yep! It's still working for me. But now unknown/custom events will have type Event instead of any. 👍

@nnelgxorz
Copy link
Contributor Author

@manucorporat
Copy link
Contributor

Amazing! going to merge another PR first, then this one!

@manucorporat manucorporat merged commit 190b34a into QwikDev:main Jul 26, 2022
@nnelgxorz nnelgxorz deleted the event-types branch July 26, 2022 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants