Created
April 14, 2015 17:54
-
-
Save bsstoner/1371e0f31539f7be2982 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function destroyViews(views){ | |
if (!views) { return; } | |
var v; | |
if ($.isArray(views)) { | |
for (var i=0; i<views.length; i++) { | |
v = views[i]; | |
if(v && $.isArray(v)){ | |
destroyViews(v); | |
} else { | |
v && v.destroy && v.destroy(); | |
} | |
} | |
views = null; | |
} else { | |
for(var c in views){ | |
v = views[c]; | |
if(v && $.isArray(v)){ | |
destroyViews(v); | |
} else { | |
v && v.destroy && v.destroy(); | |
} | |
delete views[c]; | |
} | |
} | |
}(this.views); | |
delete this.views; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment