ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

[Feature Request]: Properties of type function

Open swendlandt opened this issue 1 year ago • 2 comments

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

  • [X] I’m not disclosing any internal or sensitive information.

swendlandt avatar Oct 08 '24 09:10 swendlandt

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

Best Regards, Nikolay Hristov

NHristov-sap avatar Oct 10 '24 08:10 NHristov-sap

@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.

pskelin avatar Oct 16 '24 05:10 pskelin

Hello, everyone! The issue has been inactive for 21 days. If there are still questions or comments, please feel free to continue the discussion. Inactive issues will be closed after 7 days!

github-actions[bot] avatar Nov 25 '24 00:11 github-actions[bot]

Hello, everyone! The issue has been inactive for 28 days, so I am closing the issue.

github-actions[bot] avatar Dec 02 '24 00:12 github-actions[bot]