Use of this.own() method in dojo

The short answer is: most of the things that you define inside .own() are getting correctly removed once the widget itself is destroyed. Using .own() prevents memory leaks in your app.


The own function is defined in dijit/Destroyable, which is a base of dijit/_WidgetBase and thus most widgets.

dijit/Destroyable is used to track handles of an instance, and then destroy them when the instance is destroyed. The application must call destroy() on the instance in order to release the handles

http://dojotoolkit.org/reference-guide/1.8/dijit/Destroyable.html

http://dojotoolkit.org/reference-guide/1.8/dojo/Evented.html