This repository was archived by the owner on Jun 26, 2020. It is now read-only.
File tree 4 files changed +17
-1
lines changed
4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -351,7 +351,9 @@ export default class DataController {
351
351
/**
352
352
* Removes all event listeners set by the DataController.
353
353
*/
354
- destroy ( ) { }
354
+ destroy ( ) {
355
+ this . stopListening ( ) ;
356
+ }
355
357
356
358
/**
357
359
* Checks if all provided root names are existing editor roots.
Original file line number Diff line number Diff line change @@ -121,6 +121,14 @@ export default class Document {
121
121
this . _postFixers . add ( postFixer ) ;
122
122
}
123
123
124
+ /**
125
+ * Destroys this instance. Makes sure that all observers are destroyed and listeners removed.
126
+ */
127
+ destroy ( ) {
128
+ this . roots . map ( root => root . destroy ( ) ) ;
129
+ this . stopListening ( ) ;
130
+ }
131
+
124
132
/**
125
133
* Performs post-fixer loops. Executes post-fixer callbacks as long as none of them has done any changes to the model.
126
134
*
Original file line number Diff line number Diff line change @@ -77,6 +77,10 @@ export default class EditableElement extends ContainerElement {
77
77
}
78
78
}
79
79
80
+ destroy ( ) {
81
+ this . stopListening ( ) ;
82
+ }
83
+
80
84
/**
81
85
* Returns document associated with the editable.
82
86
*
Original file line number Diff line number Diff line change @@ -398,6 +398,8 @@ export default class View {
398
398
observer . destroy ( ) ;
399
399
}
400
400
401
+ this . document . destroy ( ) ;
402
+
401
403
this . stopListening ( ) ;
402
404
}
403
405
You can’t perform that action at this time.
0 commit comments