Select to view content in your preferred language

WAB - what is the reason of wrapping the button-function linkage with"this.own"?

477
2
Jump to solution
03-22-2022 08:31 AM
Labels (1)
MichaelLev
Regular Contributor

I use WebAppBuilder 2.22 (developer edition) to develop 3D web apps with my developed custom widgets (esri js API 4.22) for our portal.

However, I do not know why in all ESRI widgets code, everywhere when linking button click to a function, the linkage is wrapped with "this.own".

What is the purpose and benefit of doing it?

1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

This is part of the _WidgetBase structure that Dojo uses. It makes sure that everything is dealt with properly when the widget is destroyed. Read more about it under the "Owning handles" section of this page https://dojotoolkit.org/documentation/tutorials/1.10/understanding_widgetbase/index.html

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

This is part of the _WidgetBase structure that Dojo uses. It makes sure that everything is dealt with properly when the widget is destroyed. Read more about it under the "Owning handles" section of this page https://dojotoolkit.org/documentation/tutorials/1.10/understanding_widgetbase/index.html

MichaelLev
Regular Contributor

Thank you!

May I ask - I can write "this.someButton.onClick = this.someHandlerFunction;"

How is it, compared to "this.own(on(..." ?

0 Kudos