Skip to content
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

[Feature Request]: Properties of type function #9989

Open
1 task done
swendlandt opened this issue Oct 8, 2024 · 2 comments
Open
1 task done

[Feature Request]: Properties of type function #9989

swendlandt opened this issue Oct 8, 2024 · 2 comments

Comments

@swendlandt
Copy link

swendlandt commented Oct 8, 2024

Feature Request Description

ui5-webcomponents define different types of properties: https://sap.github.io/ui5-webcomponents/docs/development/properties/#type

"function" is not one of them, but it could be helpful to pass callbacks to a custom web component. I am aware that in general custom events are preferable over callbacks for web components, but there are still use cases where callbacks make sense in my opinion, e.g. an asynchronous callback to fetch data.

Proposed Solution

Provide a new type of property "function"

Proposed Alternatives

No response

Organization

SAP

Additional Context

No response

Priority

Medium

Privacy Policy

  • I’m not disclosing any internal or sensitive information.
@NHristov-sap
Copy link
Contributor

Hello @SAP/ui5-webcomponents-topic-core , take a look of this feature request.

Best Regards,
Nikolay Hristov

@pskelin
Copy link
Contributor

pskelin commented Oct 16, 2024

@swendlandt you don't strictly need a type other than Boolean and Number - they are used for converting from property to an attribute and vice versa. The remaining types are String which is 1:1 mapping with the attribute and the rest effectively set { noAttribute: true }

For your usage, you can directly write

	@property({ noAttribute: true })
	callback?: () => void;

and then document what is the expected value of the property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants