Custom Components: return value for events

In my custom component, I’m using an external lib which let me define an event handler E1 for validating a value. I want to offer the option to implement this event handler to consumers of my custom component.

So, in my custom component, I’m creating an event with handler E2 which can be implemented with block logic. In my component code, I’m configuring my external library so that the handler E1 is defined as “my” handler E2.

This works fine, but I’m not succeeding to return a value from my handler E2 to E1. Actually, such a value (let’s say true or false) is needed to encode the decision of the evaluation and I need to pass this decision into the external lib to be processed further.
I’m trying to use the “return” block, but this doesn’t show an effect.

Any idea? From my perspective, for this use case it makes sense to have return parameters for component event handlers.

Regards,

While thinking about my own question :slight_smile:
I admit, it does not make sense to have return parameters for real event handlers.
What I really want is to let consumers of my component implement a lifecycle hook which is offered by a lib embedded into my component. So what I’m looking for is more an optional ACTION which can be implemented by consumers of my component, using codeless blocks of course.

Maybe this boils down to the question: “for custom components, do you want to allow to define lifecycle hooks, which can optionally be implemented by component consumers”?

Regards,

Hi @Klaas_Klever

Having an optional output in an event handler isn’t a bad idea, and for me it makes sense.

According to Actions, I assume I do not understand your questions, custom components have the ability to define their own actions (codeless blocks)

when you say: " lifecycle hooks" do you mean

  • On Before Mount
  • On Mounted

  • ?

Hi @vladimir-upirov

Having an optional output in an event handler isn’t a bad idea, and for me it makes sense.

Good. This would solve my issue.

According to Actions, I assume I do not understand your questions, custom components have the ability to define their own actions (codeless blocks)
when you say: " lifecycle hooks" do you mean

I mean anything which is related to the lifecycle of things within the component. For instance, imagine a component which produces a popup with an OK-Button. A lifecycle event could then be On OK Button Pressed. I want the consumer of this component to implement this hook, not the component author. Currently, this is possible only for component events. If such events can return a value, then I could implement my case with this.

Regards,

Hello @Klaas_Klever!

I’ve created an internal ticket BKNDLSS-29208 to add this feature, we will let you know as soon as it is done.

Regards,
Alexander