-
Notifications
You must be signed in to change notification settings - Fork 4
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
Proposal bind shorthand #37
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # force-app/lwc/signals/core.js # src/lwc/signals/core.ts
} | ||
} | ||
|
||
function $binded(component: Record<string, object>, propertyName: string) { |
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.
Rename to just bind (or bound)
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.
go with bind it's pretty standard
import { counter, counterPlusTwo } from "c/demoSignals"; | ||
|
||
export default class CountTracker extends LightningElement { | ||
bindTest = $binded(this, "bindTest").to(counter); |
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.
I understand why you are doing this but I don't love it. Not sure what would be a better way to do the binding
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.
Yeah, that's why I'm keeping it as a proposal stage until I get some feedback, not sure if you saw the issue I put up for discussion: #38
I don't want to merge if its going to be detrimental compare to what exists today, but I haven't found a better way of doing it with how Javascript works today. The only way I can think this could be done is by using decorators, but JS doesn't support those yet.
this.propertyName = propertyName; | ||
} | ||
to(signal) { | ||
$effect(() => { |
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.
is this ok performance wise?
No description provided.