core
core copied to clipboard
offer @Decorator usage for events
current required code:
runEvent(){
// handle event
}
onStart() {
Events.testEvent.connect(() => {
this.runEvent()
});
// other code
}
potential required code:
@testEvent()
runEvent(){
// handle event
}
onStart(){
// other code
}
it's so much cleaner
That's a really cool idea, it would be cool to see it added!
The decorator should be applied to components or services and have maid task automatically given to the connection.
@Component({})
export class TimeGui extends BaseComponent {
@Connect(workspaceAttribs.getChangedSignal('TimeLeft')) // support for every signals
private updateTime() {
this.instance.Text = tostring(workspaceAttribs.get('TimeLeft'))
}
}
That's a really cool idea, it would be cool to see it added!
The decorator should be applied to components or services and have maid task automatically given to the connection.
@Component({}) export class TimeGui extends BaseComponent { @Connect(workspaceAttribs.getChangedSignal('TimeLeft')) // support for every signals private updateTime() { this.instance.Text = tostring(workspaceAttribs.get('TimeLeft')) } }
This is for @flamework/networking
and not signals. Something like that would be out of scope for Flamework and could be implemented using the modding API or a custom decorator.