Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Expose GetPropertyChangedSignal declaratively #28

Closed
LPGhatguy opened this issue Feb 23, 2018 · 3 comments
Closed

Expose GetPropertyChangedSignal declaratively #28

LPGhatguy opened this issue Feb 23, 2018 · 3 comments
Labels
feature: planned A feature that's been accepted into the project's roadmap.

Comments

@LPGhatguy
Copy link
Contributor

Right now, you can connect to the Changed event in Roact easily with Roact.Event.Changed, but using GetPropertyChangedSignal(name) on a specific property is much more performant and is much cleaner.

Roact makes that painful right now -- the only way right now is to connect in didMount and disconnect in willUnmount, typical for wrappers around APIs like this.

I think we can make Roact support GetPropertyChangedSignal as a first-class citizen for events.

@LPGhatguy LPGhatguy added the feature: planned A feature that's been accepted into the project's roadmap. label Feb 23, 2018
@AmaranthineCodices
Copy link
Contributor

Proposed API:

Roact.Change.[PropName]

e.g. for a TextBox:

Roact.createElement("TextBox", {
    [Roact.Change.Text] = function(rbx)
        print("text changed to "..rbx.Text)
    end,
})

@AmaranthineCodices
Copy link
Contributor

This can be closed now after #51 - I forgot to mention this issue in that PR!

@LPGhatguy
Copy link
Contributor Author

This is super super handy, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature: planned A feature that's been accepted into the project's roadmap.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants