StephanWagner/jBox — pull request #6 by alpadev (2014-08-10 17:55:13+00:00)
Title: Updates: Unique ID generation

Since a jbox may be not instantly injected into the DOM we will end up with some jboxes that have the same id since the old method was relating on the DOM. That way you will have racing conditions between when a new jbox is created and when another one is added to the DOM.

Fixed that by using a static closure that will return an integer that is increased by one everytime it is getting called. I'll admit it won't catch deleted jboxes like your method but relating on really unique IDs is probably better than having several jboxes with the same id that eventually will mess when this.id is used.