@ -288,7 +288,8 @@ Core.prototype.isActive = function () {
* /
Core . prototype . destroy = function ( ) {
// unbind datasets
this . clear ( ) ;
this . setItems ( null ) ;
this . setGroups ( null ) ;
// remove all event listeners
this . off ( ) ;
@ -455,37 +456,6 @@ Core.prototype.getVisibleItems = function() {
return this . itemSet && this . itemSet . getVisibleItems ( ) || [ ] ;
} ;
/ * *
* Clear the Core . By Default , items , groups and options are cleared .
* Example usage :
*
* timeline . clear ( ) ; // clear items, groups, and options
* timeline . clear ( { options : true } ) ; // clear options only
*
* @ param { Object } [ what ] Optionally specify what to clear . By default :
* { items : true , groups : true , options : true }
* /
Core . prototype . clear = function ( what ) {
// clear items
if ( ! what || what . items ) {
this . setItems ( null ) ;
}
// clear groups
if ( ! what || what . groups ) {
this . setGroups ( null ) ;
}
// clear options of timeline and of each of the components
if ( ! what || what . options ) {
this . components . forEach ( component => component . setOptions ( component . defaultOptions ) ) ;
this . setOptions ( this . defaultOptions ) ; // this will also do a redraw
}
} ;
/ * *
* Set Core window such that it fits all items
* @ param { Object } [ options ] Available options :