Przeglądaj źródła

Improved API docs.

Maciej Bukowski 6 lat temu
rodzic
commit
351434cbf9

+ 3 - 0
packages/ckeditor5-watchdog/docs/features/watchdog.md

@@ -9,6 +9,8 @@ The {@link module:watchdog/watchdog~Watchdog} feature allows you to create a wra
 
 **Note**: The watchdog does not handle errors during editor initialization (`Editor.create()`) and editor destruction (`editor.destroy()`). Errors at these stages mean that there is a serious problem in the code integrating the editor and such problem cannot be easily fixed restarting the editor.
 
+**Note**: A new editor instance is created each time the watchdog is restarted. Thus the editor instance should not be kept internally. Use the `watchdog.editor` each time you need to access the editor. It also means that you should not execute any actions on `editor.create` because these actions will not be executed when the editor restarts. Use `watchdog.create` instead, or add a plugin and add your code in the `plugin#init`, or listen on `watchdog#restart` to handle restarts.
+
 ## Basic implementation
 
 ```js
@@ -30,3 +32,4 @@ watchdog.create( document.querySelector( '#editor' ), {
 		const editor = watchdog.editor;
 	} );
 ```
+

+ 7 - 3
packages/ckeditor5-watchdog/src/watchdog.js

@@ -27,6 +27,9 @@ import areConnectedThroughProperties from '@ckeditor/ckeditor5-utils/src/areconn
  * and editor destruction (`editor.destroy()`). Errors at these stages mean that there is a serious
  * problem in the code integrating the editor and such problem cannot be easily fixed restarting the editor.
  *
+ * A new editor instance is created each time the watchdog is restarted. Thus the editor instance should not be kept
+ * internally. Use the `watchdog.editor` each time you need to access the editor.
+ *
  * Basic usage:
  *
  * 		const watchdog = Watchdog.for( ClassicEditor );
@@ -56,9 +59,10 @@ import areConnectedThroughProperties from '@ckeditor/ckeditor5-utils/src/areconn
  */
 export default class Watchdog {
 	/**
-	 * @param {Object} config
-	 * @param {Number} config.crashNumberLimit
-	 * @param {Number} config.waitingTime
+	 * @param {Object} config The watchdog plugin configuration.
+	 * @param {Number} config.crashNumberLimit A threshold specifying the number of crashes
+	 * when the watchdog stops restarting the editor in case of errors.
+	 * @param {Number} config.waitingTime A minimum amount of time between saving editor data internally.
 	 */
 	constructor( { crashNumberLimit, waitingTime } = {} ) {
 		/**