mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
feat(gridster): destroy element's data and optionally remove from DOM
This commit is contained in:
@@ -3041,9 +3041,12 @@
|
||||
* Destroy this gridster by removing any sign of its presence, making it easy to avoid memory leaks
|
||||
*
|
||||
* @method destroy
|
||||
* @return {undefined}
|
||||
* @param {Boolean} remove If true, remove gridster from DOM.
|
||||
* @return {Object} Returns the instance of the Gridster class.
|
||||
*/
|
||||
fn.destroy = function(){
|
||||
fn.destroy = function(remove) {
|
||||
this.$el.removeData('gridster');
|
||||
|
||||
// remove bound callback on window resize
|
||||
$(window).unbind('.gridster');
|
||||
|
||||
@@ -3053,10 +3056,7 @@
|
||||
|
||||
this.remove_style_tags();
|
||||
|
||||
// lastly, remove gridster element
|
||||
// this will additionally cause any data associated to this element to be removed, including this
|
||||
// very gridster instance
|
||||
this.$el.remove();
|
||||
remove && this.$el.remove();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user