Browse Source

Timeline.destroy works

css_transitions
jos 10 years ago
parent
commit
c3f8b1f168
4 changed files with 9 additions and 13 deletions
  1. +1
    -0
      HISTORY.md
  2. +7
    -0
      docs/timeline.html
  3. +1
    -12
      src/timeline/Timeline.js
  4. +0
    -1
      src/timeline/component/ItemSet.js

+ 1
- 0
HISTORY.md View File

@ -6,6 +6,7 @@ http://visjs.org
### Timeline ### Timeline
- Implemented function `destroy` to neatly cleanup a Timeline.
- Implemented support for dragging the timeline contents vertically. - Implemented support for dragging the timeline contents vertically.
- Implemented options `zoomable` and `moveable`. - Implemented options `zoomable` and `moveable`.
- Changed default value of option `showCurrentTime` to true. - Changed default value of option `showCurrentTime` to true.

+ 7
- 0
docs/timeline.html View File

@ -673,6 +673,13 @@ timeline.clear({options: true}); // clear options only
</td> </td>
</tr> </tr>
<tr>
<td>destroy()</td>
<td>none</td>
<td>Destroy the Timeline. The timeline is removed from memory. all DOM elements and event listeners are cleaned up.
</td>
</tr>
<tr> <tr>
<td>fit()</td> <td>fit()</td>
<td>none</td> <td>none</td>

+ 1
- 12
src/timeline/Timeline.js View File

@ -227,7 +227,7 @@ Timeline.prototype.destroy = function () {
// cleanup hammer touch events // cleanup hammer touch events
for (var event in this.listeners) { for (var event in this.listeners) {
if (this.listeners.hasOwnProperty(event)) { if (this.listeners.hasOwnProperty(event)) {
this.hammer.off(event, this.listeners[event]);
delete this.listeners[event];
} }
} }
this.listeners = null; this.listeners = null;
@ -238,17 +238,6 @@ Timeline.prototype.destroy = function () {
component.destroy(); component.destroy();
}); });
// remove all components
this.components = [];
this.range = null;
this.timeAxis = null;
this.itemSet = null;
this.currentTime = null;
this.customTime = null;
//this.body.util.snap = null;
//this.body.util.toTime = null;
//this.body.util.toScreen = null;
this.body = null; this.body = null;
}; };

+ 0
- 1
src/timeline/component/ItemSet.js View File

@ -296,7 +296,6 @@ ItemSet.prototype.destroy = function() {
this.setItems(null); this.setItems(null);
this.setGroups(null); this.setGroups(null);
this.hammer.enable(false);
this.hammer = null; this.hammer = null;
this.body = null; this.body = null;

Loading…
Cancel
Save