瀏覽代碼

Aligned check in the `remove()` to other code parts.

Maciej Bukowski 6 年之前
父節點
當前提交
25e8795d17
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      packages/ckeditor5-watchdog/src/contextwatchdog.js

+ 6 - 6
packages/ckeditor5-watchdog/src/contextwatchdog.js

@@ -213,15 +213,13 @@ export default class ContextWatchdog extends Watchdog {
 	 */
 	remove( itemNames ) {
 		return this._actionQueue.enqueue( () => {
+			console.log( 'remove' );
+
 			return Promise.all( itemNames.map( itemName => {
-				const watchdog = this._watchdogs.get( itemName );
+				const watchdog = this._getWatchdog( itemName );
 
 				this._watchdogs.delete( itemName );
 
-				if ( !watchdog ) {
-					throw new Error( `There is no watchdog named: '${ itemName }'.` );
-				}
-
 				return watchdog.destroy();
 			} ) );
 		} );
@@ -271,6 +269,7 @@ export default class ContextWatchdog extends Watchdog {
 	 */
 	_restart() {
 		return this._actionQueue.enqueue( () => {
+			console.log( 'restarting' );
 			this.state = 'initializing';
 
 			return this._destroy()
@@ -278,7 +277,8 @@ export default class ContextWatchdog extends Watchdog {
 					console.error( 'An error happened during destructing.', err );
 				} )
 				.then( () => this._create() )
-				.then( () => this.fire( 'restart' ) );
+				.then( () => this.fire( 'restart' ) )
+				.then( () => console.log( 'restarted' ) );
 		} );
 	}