I'm using the featherlight
library to show lightboxes. I'm using coffee and so at the beginning of my js file I have
myFeatherBox = void 0;
Later, when I want to use it I do stuff like this:
if (myFeatherBox != null) {
myFeatherBox.close();
}
myFeatherBox = $.featherlight("<div>whatever</div>");
I test for null in case a featherbox is already opened, in which case I close it. To avoid leaving masses of these things in memory though, I'm essentially creating a new box in the old variable.
So I'm wondering whether that's just orphaning the old box in memory (and if so how to clean it) and whether this is the way to do things.