Added a special onDeconstruct template function that allows a function to be invoked when the element is being destroyed.
This commit is contained in:
		| @@ -775,6 +775,25 @@ class IgniteTemplate { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Adds an event handler that gets called when this element is being deconstructed from the DOM. | ||||
|      * @param {Function} eventCallback The callback function to be invoked once this element is disconnected. | ||||
|      * @returns {IgniteTemplate} This ignite template so function calls can be chained.  | ||||
|      */ | ||||
|     onDeconstruct(eventCallback) { | ||||
|         if (eventCallback) { | ||||
|             this._destructors.push(() => { | ||||
|                 IgniteRendering.push(); | ||||
|  | ||||
|                 eventCallback(); | ||||
|  | ||||
|                 IgniteRendering.pop(); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Adds a CSS property to this template with a value and priority. | ||||
|      * @param {String} name The name of the CSS property to set. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user