-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove on prefix on Angular Events #1565
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 603bf04 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -60,7 +61,7 @@ export const DO_NOT_USE_VARS_TRANSFORMS = ( | |||
outputVars?.forEach((_var) => { | |||
// determine expression edge cases onMessage( to this.onMessage.emit( | |||
const regexp = '(^|\\s|;|\\()(props\\.?)' + _var + '\\('; | |||
const replacer = '$1' + context + _var + '.emit('; | |||
const replacer = '$1' + context + removeOnFromAngularOutputEvent(_var) + '.emit('; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't import a function from a generator inside helpers
. Right now DO_NOT_USE_VARS_TRANSFORMS
is used by generators/html
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So better do that mainipulation inside
processAngularCode as part as packages/core/src/generators/angular/index.ts ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes do the manipulation inside packages/core/src/generators/angular/*
there is a helper.ts
as well
Remove on prefix on Angular Events
* wip: remove on from output variables * remove on also on emit event * wip on test * add event child props * add e2e test * Event listener e2e test * clean up * add changeset
@nmerget Thanks a lot for your feedback. I have some more questions:
<EventChild
onConfirm$={$((name) => _onConfirm(props, state, name))}
onCancel$={$(() => _onCancel(props, state))}
></EventChild> to <EventChild
onConfirm={$((name) => _onConfirm(props, state, name))}
onCancel={$(() => _onCancel(props, state))}
></EventChild>
Unfortunately, I know too little about Qwik to fix it. For some reason, the route |
|
|
Maybe this is a good hint I got in my PR: mitosis/packages/core/src/generators/svelte/svelte.ts Lines 150 to 185 in 664f4a1
|
@nmerget but the onEvent is part of When I read the comment of component.hooks.onEvent I see the following comments:
It requires elementRef: T which refers to HTML Element. So this is just for HTML refs to add event listeners, like touch, keydown... this is not the same as output emitters of the component. The output can be called from JS and must not be part of an HTML ref. So I think onEvents is not the way to go. |
Sorry I think it was a little bit confusing. I tought about using something like |
Remove on prefix on Angular Events
Description
Please provide the following information:
Make sure to follow the PR preparation steps in CONTRIBUTING.md before submitting your PR:
yarn fmt:prettier
.yarn test:update
yarn g:changeset
and follow the CLI instructions. Alternatively, use the Changeset Github Bot to create the file.