fatihacet/spark

disposeInternal should be implemented at Framework level, starting from core.Object.

fatihacet opened this issue · 1 comments

disposeInternal should be implemented at Framework level, starting from core.Object.

Fixed with b0e9ef6...b89e2cc

Introduced destroy method to framework and implemented the core destroy in Object and override it in necessary subclasses like View, DraggableView etc.

Object's destroy will call dispose and disposeInternal of the EventTarget so we are sure that all event listeners will be purged.

View will destroy all child views and it's responsible to unlisten DOM related events. So we are sure that every events bound to View will also be purged.

Some classes like DraggableView, Textarea, Router will also dispose the internal used classes like goog.fx.Dragger, goog.ui.CharCounter etc.

I heavily tested the listener counts before and after destroying a view to make sure we are really unlisten all those events and results were fantastic. Here is the results for Modal and DraggableView.

http://take.ms/BdJip

http://take.ms/k88YC