Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge 7adf235 into 1f213f9
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Jan 16, 2019
2 parents 1f213f9 + 7adf235 commit a516052
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controller/datacontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ export default class DataController {
/**
* Removes all event listeners set by the DataController.
*/
destroy() {}
destroy() {
this.stopListening();
}

/**
* Checks if all provided root names are existing editor roots.
Expand Down
8 changes: 8 additions & 0 deletions src/view/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ export default class Document {
this._postFixers.add( postFixer );
}

/**
* Destroys this instance. Makes sure that all observers are destroyed and listeners removed.
*/
destroy() {
this.roots.map( root => root.destroy() );
this.stopListening();
}

/**
* Performs post-fixer loops. Executes post-fixer callbacks as long as none of them has done any changes to the model.
*
Expand Down
4 changes: 4 additions & 0 deletions src/view/editableelement.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export default class EditableElement extends ContainerElement {
}
}

destroy() {
this.stopListening();
}

/**
* Returns document associated with the editable.
*
Expand Down
2 changes: 2 additions & 0 deletions src/view/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ export default class View {
observer.destroy();
}

this.document.destroy();

this.stopListening();
}

Expand Down

0 comments on commit a516052

Please sign in to comment.