-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Add attributes support to New #1
Comments
Possible API (implemented as part of the New "Instance" {
[Attribute "Foo"] = "bar", -- if a state or computed object, binds to the attribute
[AttributeChange "Foo"] = function(newValue)
print("The attribute was changed to:", newValue)
end
} |
An alternate possible API from Twitter (adapted from a suggestion by @/bradsharppp): New "Instance" {
[Attributes] = {
Foo = "bar",
[OnChange "Foo"] = function(newValue)
print("The attribute was changed to:", newValue)
end
}
} Alternatively, we could keep |
I personally prefer the first option as it is very similar to the API for normal properties. |
Agreed - I don't personally see many use cases where a lot of attributes are being used at once within the context of Fusion, so I think it'd overall be cleaner not to use a nested table. |
Same here! I think fusion should eliminate the times where you normally in Roact get huge files with lots of scopes. |
Currently it's not possible to set attributes on instances being created with the New function. Additionally, it's not possible to listen for changes on attributes.
While attributes aren't particularly useful within Fusion, having support for them would make it easier to integrate Fusion with legacy UI codebases which depend on them.
The text was updated successfully, but these errors were encountered: