@ckeditor/ckeditor5-watchdog 41.3.0-alpha.3 → 41.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/src/editorwatchdog.d.ts +7 -0
- package/src/editorwatchdog.js +15 -2
- package/dist/content-index.css +0 -4
- package/dist/editor-index.css +0 -4
- package/dist/index.css +0 -4
- package/dist/types/augmentation.d.ts +0 -19
- package/dist/types/contextwatchdog.d.ts +0 -337
- package/dist/types/editorwatchdog.d.ts +0 -188
- package/dist/types/index.d.ts +0 -15
- package/dist/types/utils/areconnectedthroughproperties.d.ts +0 -12
- package/dist/types/utils/getsubnodes.d.ts +0 -12
- package/dist/types/watchdog.d.ts +0 -233
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-watchdog",
|
|
3
|
-
"version": "41.3.0
|
|
3
|
+
"version": "41.3.0",
|
|
4
4
|
"description": "A watchdog feature for CKEditor 5 editors. It keeps a CKEditor 5 editor instance running.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"directory": "packages/ckeditor5-watchdog"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
|
-
"dist",
|
|
28
27
|
"lang",
|
|
29
28
|
"src/**/*.js",
|
|
30
29
|
"src/**/*.d.ts",
|
package/src/editorwatchdog.d.ts
CHANGED
|
@@ -19,6 +19,13 @@ export default class EditorWatchdog<TEditor extends Editor = Editor> extends Wat
|
|
|
19
19
|
* The current editor instance.
|
|
20
20
|
*/
|
|
21
21
|
private _editor;
|
|
22
|
+
/**
|
|
23
|
+
* A promise associated with the life cycle of the editor (creation or destruction processes).
|
|
24
|
+
*
|
|
25
|
+
* It is used to prevent the initialization of the editor if the previous instance has not been destroyed yet,
|
|
26
|
+
* and conversely, to prevent the destruction of the editor if it has not been initialized.
|
|
27
|
+
*/
|
|
28
|
+
private _lifecyclePromise;
|
|
22
29
|
/**
|
|
23
30
|
* Throttled save method. The `save()` method is called the specified `saveInterval` after `throttledSave()` is called,
|
|
24
31
|
* unless a new action happens in the meantime.
|
package/src/editorwatchdog.js
CHANGED
|
@@ -22,6 +22,13 @@ export default class EditorWatchdog extends Watchdog {
|
|
|
22
22
|
* The current editor instance.
|
|
23
23
|
*/
|
|
24
24
|
this._editor = null;
|
|
25
|
+
/**
|
|
26
|
+
* A promise associated with the life cycle of the editor (creation or destruction processes).
|
|
27
|
+
*
|
|
28
|
+
* It is used to prevent the initialization of the editor if the previous instance has not been destroyed yet,
|
|
29
|
+
* and conversely, to prevent the destruction of the editor if it has not been initialized.
|
|
30
|
+
*/
|
|
31
|
+
this._lifecyclePromise = null;
|
|
25
32
|
/**
|
|
26
33
|
* Specifies whether the editor was initialized using document data (`true`) or HTML elements (`false`).
|
|
27
34
|
*/
|
|
@@ -162,7 +169,7 @@ export default class EditorWatchdog extends Watchdog {
|
|
|
162
169
|
* @param context A context for the editor.
|
|
163
170
|
*/
|
|
164
171
|
create(elementOrData = this._elementOrData, config = this._config, context) {
|
|
165
|
-
|
|
172
|
+
this._lifecyclePromise = Promise.resolve(this._lifecyclePromise)
|
|
166
173
|
.then(() => {
|
|
167
174
|
super._startErrorHandling();
|
|
168
175
|
this._elementOrData = elementOrData;
|
|
@@ -186,7 +193,10 @@ export default class EditorWatchdog extends Watchdog {
|
|
|
186
193
|
}
|
|
187
194
|
this.state = 'ready';
|
|
188
195
|
this._fire('stateChange');
|
|
196
|
+
}).finally(() => {
|
|
197
|
+
this._lifecyclePromise = null;
|
|
189
198
|
});
|
|
199
|
+
return this._lifecyclePromise;
|
|
190
200
|
}
|
|
191
201
|
/**
|
|
192
202
|
* Destroys the watchdog and the current editor instance. It fires the callback
|
|
@@ -194,13 +204,16 @@ export default class EditorWatchdog extends Watchdog {
|
|
|
194
204
|
* It also sets the state to `destroyed`.
|
|
195
205
|
*/
|
|
196
206
|
destroy() {
|
|
197
|
-
|
|
207
|
+
this._lifecyclePromise = Promise.resolve(this._lifecyclePromise)
|
|
198
208
|
.then(() => {
|
|
199
209
|
this.state = 'destroyed';
|
|
200
210
|
this._fire('stateChange');
|
|
201
211
|
super.destroy();
|
|
202
212
|
return this._destroy();
|
|
213
|
+
}).finally(() => {
|
|
214
|
+
this._lifecyclePromise = null;
|
|
203
215
|
});
|
|
216
|
+
return this._lifecyclePromise;
|
|
204
217
|
}
|
|
205
218
|
_destroy() {
|
|
206
219
|
return Promise.resolve()
|
package/dist/content-index.css
DELETED
package/dist/editor-index.css
DELETED
package/dist/index.css
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
import type { EditorData } from './editorwatchdog.js';
|
|
10
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
11
|
-
interface EditorConfig {
|
|
12
|
-
/**
|
|
13
|
-
* The temporary property that is used for passing data to the plugin which restores the editor state.
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
_watchdogInitialData?: EditorData;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module watchdog/contextwatchdog
|
|
11
|
-
*/
|
|
12
|
-
import type { Context, Editor, EditorConfig, ContextConfig } from 'ckeditor5/src/core.js';
|
|
13
|
-
import type { ArrayOrItem, CKEditorError } from 'ckeditor5/src/utils.js';
|
|
14
|
-
import Watchdog, { type WatchdogConfig, type WatchdogState } from './watchdog.js';
|
|
15
|
-
import EditorWatchdog, { type EditorCreatorFunction } from './editorwatchdog.js';
|
|
16
|
-
/**
|
|
17
|
-
* A watchdog for the {@link module:core/context~Context} class.
|
|
18
|
-
*
|
|
19
|
-
* See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and
|
|
20
|
-
* how to use it.
|
|
21
|
-
*/
|
|
22
|
-
export default class ContextWatchdog<TContext extends Context = Context> extends Watchdog {
|
|
23
|
-
/**
|
|
24
|
-
* A map of internal watchdogs for added items.
|
|
25
|
-
*/
|
|
26
|
-
protected _watchdogs: Map<string, EditorWatchdog<Editor>>;
|
|
27
|
-
/**
|
|
28
|
-
* The watchdog configuration.
|
|
29
|
-
*/
|
|
30
|
-
private readonly _watchdogConfig;
|
|
31
|
-
/**
|
|
32
|
-
* The current context instance.
|
|
33
|
-
*/
|
|
34
|
-
private _context;
|
|
35
|
-
/**
|
|
36
|
-
* Context properties (nodes/references) that are gathered during the initial context creation
|
|
37
|
-
* and are used to distinguish the origin of an error.
|
|
38
|
-
*/
|
|
39
|
-
private _contextProps;
|
|
40
|
-
/**
|
|
41
|
-
* An action queue, which is used to handle async functions queuing.
|
|
42
|
-
*/
|
|
43
|
-
private _actionQueues;
|
|
44
|
-
/**
|
|
45
|
-
* The configuration for the {@link module:core/context~Context}.
|
|
46
|
-
*/
|
|
47
|
-
private _contextConfig?;
|
|
48
|
-
/**
|
|
49
|
-
* The creation method.
|
|
50
|
-
*
|
|
51
|
-
* @see #setCreator
|
|
52
|
-
*/
|
|
53
|
-
protected _creator: (config: ContextConfig) => Promise<TContext>;
|
|
54
|
-
/**
|
|
55
|
-
* The destruction method.
|
|
56
|
-
*
|
|
57
|
-
* @see #setDestructor
|
|
58
|
-
*/
|
|
59
|
-
protected _destructor: (context: Context) => Promise<unknown>;
|
|
60
|
-
/**
|
|
61
|
-
* The watched item.
|
|
62
|
-
*/
|
|
63
|
-
_item: unknown;
|
|
64
|
-
/**
|
|
65
|
-
* The context watchdog class constructor.
|
|
66
|
-
*
|
|
67
|
-
* ```ts
|
|
68
|
-
* const watchdog = new ContextWatchdog( Context );
|
|
69
|
-
*
|
|
70
|
-
* await watchdog.create( contextConfiguration );
|
|
71
|
-
*
|
|
72
|
-
* await watchdog.add( item );
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* See the {@glink features/watchdog Watchdog feature guide} to learn more how to use this feature.
|
|
76
|
-
*
|
|
77
|
-
* @param Context The {@link module:core/context~Context} class.
|
|
78
|
-
* @param watchdogConfig The watchdog configuration.
|
|
79
|
-
*/
|
|
80
|
-
constructor(Context: {
|
|
81
|
-
create(...args: any): Promise<TContext>;
|
|
82
|
-
}, watchdogConfig?: WatchdogConfig);
|
|
83
|
-
/**
|
|
84
|
-
* Sets the function that is responsible for the context creation.
|
|
85
|
-
* It expects a function that should return a promise (or `undefined`).
|
|
86
|
-
*
|
|
87
|
-
* ```ts
|
|
88
|
-
* watchdog.setCreator( config => Context.create( config ) );
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
setCreator(creator: (config: ContextConfig) => Promise<TContext>): void;
|
|
92
|
-
/**
|
|
93
|
-
* Sets the function that is responsible for the context destruction.
|
|
94
|
-
* Overrides the default destruction function, which destroys only the context instance.
|
|
95
|
-
* It expects a function that should return a promise (or `undefined`).
|
|
96
|
-
*
|
|
97
|
-
* ```ts
|
|
98
|
-
* watchdog.setDestructor( context => {
|
|
99
|
-
* // Do something before the context is destroyed.
|
|
100
|
-
*
|
|
101
|
-
* return context
|
|
102
|
-
* .destroy()
|
|
103
|
-
* .then( () => {
|
|
104
|
-
* // Do something after the context is destroyed.
|
|
105
|
-
* } );
|
|
106
|
-
* } );
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
setDestructor(destructor: (context: Context) => Promise<unknown>): void;
|
|
110
|
-
/**
|
|
111
|
-
* The context instance. Keep in mind that this property might be changed when the context watchdog restarts,
|
|
112
|
-
* so do not keep this instance internally. Always operate on the `ContextWatchdog#context` property.
|
|
113
|
-
*/
|
|
114
|
-
get context(): Context | null;
|
|
115
|
-
/**
|
|
116
|
-
* Initializes the context watchdog. Once it is created, the watchdog takes care about
|
|
117
|
-
* recreating the context and the provided items, and starts the error handling mechanism.
|
|
118
|
-
*
|
|
119
|
-
* ```ts
|
|
120
|
-
* await watchdog.create( {
|
|
121
|
-
* plugins: []
|
|
122
|
-
* } );
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
* @param contextConfig The context configuration. See {@link module:core/context~Context}.
|
|
126
|
-
*/
|
|
127
|
-
create(contextConfig?: ContextConfig): Promise<unknown>;
|
|
128
|
-
/**
|
|
129
|
-
* Returns an item instance with the given `itemId`.
|
|
130
|
-
*
|
|
131
|
-
* ```ts
|
|
132
|
-
* const editor1 = watchdog.getItem( 'editor1' );
|
|
133
|
-
* ```
|
|
134
|
-
*
|
|
135
|
-
* @param itemId The item ID.
|
|
136
|
-
* @returns The item instance or `undefined` if an item with a given ID has not been found.
|
|
137
|
-
*/
|
|
138
|
-
getItem(itemId: string): unknown;
|
|
139
|
-
/**
|
|
140
|
-
* Gets the state of the given item. See {@link #state} for a list of available states.
|
|
141
|
-
*
|
|
142
|
-
* ```ts
|
|
143
|
-
* const editor1State = watchdog.getItemState( 'editor1' );
|
|
144
|
-
* ```
|
|
145
|
-
*
|
|
146
|
-
* @param itemId Item ID.
|
|
147
|
-
* @returns The state of the item.
|
|
148
|
-
*/
|
|
149
|
-
getItemState(itemId: string): WatchdogState;
|
|
150
|
-
/**
|
|
151
|
-
* Adds items to the watchdog. Once created, instances of these items will be available using the {@link #getItem} method.
|
|
152
|
-
*
|
|
153
|
-
* Items can be passed together as an array of objects:
|
|
154
|
-
*
|
|
155
|
-
* ```ts
|
|
156
|
-
* await watchdog.add( [ {
|
|
157
|
-
* id: 'editor1',
|
|
158
|
-
* type: 'editor',
|
|
159
|
-
* sourceElementOrData: document.querySelector( '#editor' ),
|
|
160
|
-
* config: {
|
|
161
|
-
* plugins: [ Essentials, Paragraph, Bold, Italic ],
|
|
162
|
-
* toolbar: [ 'bold', 'italic', 'alignment' ]
|
|
163
|
-
* },
|
|
164
|
-
* creator: ( element, config ) => ClassicEditor.create( element, config )
|
|
165
|
-
* } ] );
|
|
166
|
-
* ```
|
|
167
|
-
*
|
|
168
|
-
* Or one by one as objects:
|
|
169
|
-
*
|
|
170
|
-
* ```ts
|
|
171
|
-
* await watchdog.add( {
|
|
172
|
-
* id: 'editor1',
|
|
173
|
-
* type: 'editor',
|
|
174
|
-
* sourceElementOrData: document.querySelector( '#editor' ),
|
|
175
|
-
* config: {
|
|
176
|
-
* plugins: [ Essentials, Paragraph, Bold, Italic ],
|
|
177
|
-
* toolbar: [ 'bold', 'italic', 'alignment' ]
|
|
178
|
-
* },
|
|
179
|
-
* creator: ( element, config ) => ClassicEditor.create( element, config )
|
|
180
|
-
* ] );
|
|
181
|
-
* ```
|
|
182
|
-
*
|
|
183
|
-
* Then an instance can be retrieved using the {@link #getItem} method:
|
|
184
|
-
*
|
|
185
|
-
* ```ts
|
|
186
|
-
* const editor1 = watchdog.getItem( 'editor1' );
|
|
187
|
-
* ```
|
|
188
|
-
*
|
|
189
|
-
* Note that this method can be called multiple times, but for performance reasons it is better
|
|
190
|
-
* to pass all items together.
|
|
191
|
-
*
|
|
192
|
-
* @param itemConfigurationOrItemConfigurations An item configuration object or an array of item configurations.
|
|
193
|
-
*/
|
|
194
|
-
add(itemConfigurationOrItemConfigurations: ArrayOrItem<WatchdogItemConfiguration>): Promise<unknown>;
|
|
195
|
-
/**
|
|
196
|
-
* Removes and destroys item(s) with given ID(s).
|
|
197
|
-
*
|
|
198
|
-
* ```ts
|
|
199
|
-
* await watchdog.remove( 'editor1' );
|
|
200
|
-
* ```
|
|
201
|
-
*
|
|
202
|
-
* Or
|
|
203
|
-
*
|
|
204
|
-
* ```ts
|
|
205
|
-
* await watchdog.remove( [ 'editor1', 'editor2' ] );
|
|
206
|
-
* ```
|
|
207
|
-
*
|
|
208
|
-
* @param itemIdOrItemIds Item ID or an array of item IDs.
|
|
209
|
-
*/
|
|
210
|
-
remove(itemIdOrItemIds: ArrayOrItem<string>): Promise<unknown>;
|
|
211
|
-
/**
|
|
212
|
-
* Destroys the context watchdog and all added items.
|
|
213
|
-
* Once the context watchdog is destroyed, new items cannot be added.
|
|
214
|
-
*
|
|
215
|
-
* ```ts
|
|
216
|
-
* await watchdog.destroy();
|
|
217
|
-
* ```
|
|
218
|
-
*/
|
|
219
|
-
destroy(): Promise<unknown>;
|
|
220
|
-
/**
|
|
221
|
-
* Restarts the context watchdog.
|
|
222
|
-
*/
|
|
223
|
-
protected _restart(): Promise<unknown>;
|
|
224
|
-
/**
|
|
225
|
-
* Initializes the context watchdog.
|
|
226
|
-
*/
|
|
227
|
-
private _create;
|
|
228
|
-
/**
|
|
229
|
-
* Destroys the context instance and all added items.
|
|
230
|
-
*/
|
|
231
|
-
private _destroy;
|
|
232
|
-
/**
|
|
233
|
-
* Returns the watchdog for a given item ID.
|
|
234
|
-
*
|
|
235
|
-
* @param itemId Item ID.
|
|
236
|
-
*/
|
|
237
|
-
protected _getWatchdog(itemId: string): Watchdog;
|
|
238
|
-
/**
|
|
239
|
-
* Checks whether an error comes from the context instance and not from the item instances.
|
|
240
|
-
*
|
|
241
|
-
* @internal
|
|
242
|
-
*/
|
|
243
|
-
_isErrorComingFromThisItem(error: CKEditorError): boolean;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Fired after the watchdog restarts the context and the added items because of a crash.
|
|
247
|
-
*
|
|
248
|
-
* ```ts
|
|
249
|
-
* watchdog.on( 'restart', () => {
|
|
250
|
-
* console.log( 'The context has been restarted.' );
|
|
251
|
-
* } );
|
|
252
|
-
* ```
|
|
253
|
-
*
|
|
254
|
-
* @eventName ~ContextWatchdog#restart
|
|
255
|
-
*/
|
|
256
|
-
export type ContextWatchdogRestartEvent = {
|
|
257
|
-
name: 'restart';
|
|
258
|
-
args: [];
|
|
259
|
-
return: undefined;
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* Fired when a new error occurred in one of the added items.
|
|
263
|
-
*
|
|
264
|
-
* ```ts
|
|
265
|
-
* watchdog.on( 'itemError', ( evt, { error, itemId } ) => {
|
|
266
|
-
* console.log( `An error occurred in an item with the '${ itemId }' ID.` );
|
|
267
|
-
* } );
|
|
268
|
-
* ```
|
|
269
|
-
*
|
|
270
|
-
* @eventName ~ContextWatchdog#itemError
|
|
271
|
-
*/
|
|
272
|
-
export type ContextWatchdogItemErrorEvent = {
|
|
273
|
-
name: 'itemError';
|
|
274
|
-
args: [ContextWatchdogItemErrorEventData];
|
|
275
|
-
return: undefined;
|
|
276
|
-
};
|
|
277
|
-
/**
|
|
278
|
-
* The `itemError` event data.
|
|
279
|
-
*/
|
|
280
|
-
export type ContextWatchdogItemErrorEventData = {
|
|
281
|
-
itemId: string;
|
|
282
|
-
error: Error;
|
|
283
|
-
};
|
|
284
|
-
/**
|
|
285
|
-
* Fired after an item has been restarted.
|
|
286
|
-
*
|
|
287
|
-
* ```ts
|
|
288
|
-
* watchdog.on( 'itemRestart', ( evt, { itemId } ) => {
|
|
289
|
-
* console.log( 'An item with with the '${ itemId }' ID has been restarted.' );
|
|
290
|
-
* } );
|
|
291
|
-
* ```
|
|
292
|
-
*
|
|
293
|
-
* @eventName ~ContextWatchdog#itemRestart
|
|
294
|
-
*/
|
|
295
|
-
export type ContextWatchdogItemRestartEvent = {
|
|
296
|
-
name: 'itemRestart';
|
|
297
|
-
args: [ContextWatchdogItemRestartEventData];
|
|
298
|
-
return: undefined;
|
|
299
|
-
};
|
|
300
|
-
/**
|
|
301
|
-
* The `itemRestart` event data.
|
|
302
|
-
*/
|
|
303
|
-
export type ContextWatchdogItemRestartEventData = {
|
|
304
|
-
itemId: string;
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* The watchdog item configuration interface.
|
|
308
|
-
*/
|
|
309
|
-
export interface WatchdogItemConfiguration {
|
|
310
|
-
/**
|
|
311
|
-
* id A unique item identificator.
|
|
312
|
-
*/
|
|
313
|
-
id: string;
|
|
314
|
-
/**
|
|
315
|
-
* The type of the item to create. At the moment, only `'editor'` is supported.
|
|
316
|
-
*/
|
|
317
|
-
type: 'editor';
|
|
318
|
-
/**
|
|
319
|
-
* A function that initializes the item (the editor). The function takes editor initialization arguments
|
|
320
|
-
* and should return a promise. For example: `( el, config ) => ClassicEditor.create( el, config )`.
|
|
321
|
-
*/
|
|
322
|
-
creator: EditorCreatorFunction;
|
|
323
|
-
/**
|
|
324
|
-
* A function that destroys the item instance (the editor). The function
|
|
325
|
-
* takes an item and should return a promise. For example: `editor => editor.destroy()`
|
|
326
|
-
*/
|
|
327
|
-
destructor?: (editor: Editor) => Promise<unknown>;
|
|
328
|
-
/**
|
|
329
|
-
* The source element or data that will be passed
|
|
330
|
-
* as the first argument to the `Editor.create()` method.
|
|
331
|
-
*/
|
|
332
|
-
sourceElementOrData: string | HTMLElement;
|
|
333
|
-
/**
|
|
334
|
-
* An editor configuration.
|
|
335
|
-
*/
|
|
336
|
-
config: EditorConfig;
|
|
337
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module watchdog/editorwatchdog
|
|
11
|
-
*/
|
|
12
|
-
import type { CKEditorError } from 'ckeditor5/src/utils.js';
|
|
13
|
-
import type { Editor, EditorConfig, Context } from 'ckeditor5/src/core.js';
|
|
14
|
-
import Watchdog, { type WatchdogConfig } from './watchdog.js';
|
|
15
|
-
/**
|
|
16
|
-
* A watchdog for CKEditor 5 editors.
|
|
17
|
-
*
|
|
18
|
-
* See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and
|
|
19
|
-
* how to use it.
|
|
20
|
-
*/
|
|
21
|
-
export default class EditorWatchdog<TEditor extends Editor = Editor> extends Watchdog {
|
|
22
|
-
/**
|
|
23
|
-
* The current editor instance.
|
|
24
|
-
*/
|
|
25
|
-
private _editor;
|
|
26
|
-
/**
|
|
27
|
-
* Throttled save method. The `save()` method is called the specified `saveInterval` after `throttledSave()` is called,
|
|
28
|
-
* unless a new action happens in the meantime.
|
|
29
|
-
*/
|
|
30
|
-
private _throttledSave;
|
|
31
|
-
/**
|
|
32
|
-
* The latest saved editor data represented as a root name -> root data object.
|
|
33
|
-
*/
|
|
34
|
-
private _data?;
|
|
35
|
-
/**
|
|
36
|
-
* The last document version.
|
|
37
|
-
*/
|
|
38
|
-
private _lastDocumentVersion?;
|
|
39
|
-
/**
|
|
40
|
-
* The editor source element or data.
|
|
41
|
-
*/
|
|
42
|
-
private _elementOrData?;
|
|
43
|
-
/**
|
|
44
|
-
* Specifies whether the editor was initialized using document data (`true`) or HTML elements (`false`).
|
|
45
|
-
*/
|
|
46
|
-
private _initUsingData;
|
|
47
|
-
/**
|
|
48
|
-
* The latest record of the editor editable elements. Used to restart the editor.
|
|
49
|
-
*/
|
|
50
|
-
private _editables;
|
|
51
|
-
/**
|
|
52
|
-
* The editor configuration.
|
|
53
|
-
*/
|
|
54
|
-
private _config?;
|
|
55
|
-
/**
|
|
56
|
-
* The creation method.
|
|
57
|
-
*
|
|
58
|
-
* @see #setCreator
|
|
59
|
-
*/
|
|
60
|
-
protected _creator: EditorCreatorFunction<TEditor>;
|
|
61
|
-
/**
|
|
62
|
-
* The destruction method.
|
|
63
|
-
*
|
|
64
|
-
* @see #setDestructor
|
|
65
|
-
*/
|
|
66
|
-
protected _destructor: (editor: Editor) => Promise<unknown>;
|
|
67
|
-
private _excludedProps?;
|
|
68
|
-
/**
|
|
69
|
-
* @param Editor The editor class.
|
|
70
|
-
* @param watchdogConfig The watchdog plugin configuration.
|
|
71
|
-
*/
|
|
72
|
-
constructor(Editor: {
|
|
73
|
-
create(...args: any): Promise<TEditor>;
|
|
74
|
-
} | null, watchdogConfig?: WatchdogConfig);
|
|
75
|
-
/**
|
|
76
|
-
* The current editor instance.
|
|
77
|
-
*/
|
|
78
|
-
get editor(): TEditor | null;
|
|
79
|
-
/**
|
|
80
|
-
* @internal
|
|
81
|
-
*/
|
|
82
|
-
get _item(): TEditor | null;
|
|
83
|
-
/**
|
|
84
|
-
* Sets the function that is responsible for the editor creation.
|
|
85
|
-
* It expects a function that should return a promise.
|
|
86
|
-
*
|
|
87
|
-
* ```ts
|
|
88
|
-
* watchdog.setCreator( ( element, config ) => ClassicEditor.create( element, config ) );
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
setCreator(creator: EditorCreatorFunction<TEditor>): void;
|
|
92
|
-
/**
|
|
93
|
-
* Sets the function that is responsible for the editor destruction.
|
|
94
|
-
* Overrides the default destruction function, which destroys only the editor instance.
|
|
95
|
-
* It expects a function that should return a promise or `undefined`.
|
|
96
|
-
*
|
|
97
|
-
* ```ts
|
|
98
|
-
* watchdog.setDestructor( editor => {
|
|
99
|
-
* // Do something before the editor is destroyed.
|
|
100
|
-
*
|
|
101
|
-
* return editor
|
|
102
|
-
* .destroy()
|
|
103
|
-
* .then( () => {
|
|
104
|
-
* // Do something after the editor is destroyed.
|
|
105
|
-
* } );
|
|
106
|
-
* } );
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
setDestructor(destructor: (editor: Editor) => Promise<unknown>): void;
|
|
110
|
-
/**
|
|
111
|
-
* Restarts the editor instance. This method is called whenever an editor error occurs. It fires the `restart` event and changes
|
|
112
|
-
* the state to `initializing`.
|
|
113
|
-
*
|
|
114
|
-
* @fires restart
|
|
115
|
-
*/
|
|
116
|
-
protected _restart(): Promise<unknown>;
|
|
117
|
-
/**
|
|
118
|
-
* Creates the editor instance and keeps it running, using the defined creator and destructor.
|
|
119
|
-
*
|
|
120
|
-
* @param elementOrData The editor source element or the editor data.
|
|
121
|
-
* @param config The editor configuration.
|
|
122
|
-
* @param context A context for the editor.
|
|
123
|
-
*/
|
|
124
|
-
create(elementOrData?: HTMLElement | string | Record<string, string> | Record<string, HTMLElement>, config?: EditorConfig, context?: Context): Promise<unknown>;
|
|
125
|
-
/**
|
|
126
|
-
* Destroys the watchdog and the current editor instance. It fires the callback
|
|
127
|
-
* registered in {@link #setDestructor `setDestructor()`} and uses it to destroy the editor instance.
|
|
128
|
-
* It also sets the state to `destroyed`.
|
|
129
|
-
*/
|
|
130
|
-
destroy(): Promise<unknown>;
|
|
131
|
-
private _destroy;
|
|
132
|
-
/**
|
|
133
|
-
* Saves the editor data, so it can be restored after the crash even if the data cannot be fetched at
|
|
134
|
-
* the moment of the crash.
|
|
135
|
-
*/
|
|
136
|
-
private _save;
|
|
137
|
-
/**
|
|
138
|
-
* @internal
|
|
139
|
-
*/
|
|
140
|
-
_setExcludedProperties(props: Set<unknown>): void;
|
|
141
|
-
/**
|
|
142
|
-
* Gets all data that is required to reinitialize editor instance.
|
|
143
|
-
*/
|
|
144
|
-
private _getData;
|
|
145
|
-
/**
|
|
146
|
-
* For each attached model root, returns its HTML editable element (if available).
|
|
147
|
-
*/
|
|
148
|
-
private _getEditables;
|
|
149
|
-
/**
|
|
150
|
-
* Traverses the error context and the current editor to find out whether these structures are connected
|
|
151
|
-
* to each other via properties.
|
|
152
|
-
*
|
|
153
|
-
* @internal
|
|
154
|
-
*/
|
|
155
|
-
_isErrorComingFromThisItem(error: CKEditorError): boolean;
|
|
156
|
-
/**
|
|
157
|
-
* Clones the editor configuration.
|
|
158
|
-
*/
|
|
159
|
-
private _cloneEditorConfiguration;
|
|
160
|
-
}
|
|
161
|
-
export type EditorData = {
|
|
162
|
-
roots: Record<string, {
|
|
163
|
-
content: string;
|
|
164
|
-
attributes: string;
|
|
165
|
-
isLoaded: boolean;
|
|
166
|
-
}>;
|
|
167
|
-
markers: Record<string, {
|
|
168
|
-
rangeJSON: {
|
|
169
|
-
start: any;
|
|
170
|
-
end: any;
|
|
171
|
-
};
|
|
172
|
-
usingOperation: boolean;
|
|
173
|
-
affectsData: boolean;
|
|
174
|
-
}>;
|
|
175
|
-
commentThreads: string;
|
|
176
|
-
suggestions: string;
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* Fired after the watchdog restarts the error in case of a crash.
|
|
180
|
-
*
|
|
181
|
-
* @eventName ~EditorWatchdog#restart
|
|
182
|
-
*/
|
|
183
|
-
export type EditorWatchdogRestartEvent = {
|
|
184
|
-
name: 'restart';
|
|
185
|
-
args: [];
|
|
186
|
-
return: undefined;
|
|
187
|
-
};
|
|
188
|
-
export type EditorCreatorFunction<TEditor = Editor> = (elementOrData: HTMLElement | string | Record<string, string> | Record<string, HTMLElement>, config: EditorConfig) => Promise<TEditor>;
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module watchdog
|
|
11
|
-
*/
|
|
12
|
-
export { default as ContextWatchdog } from './contextwatchdog.js';
|
|
13
|
-
export { default as EditorWatchdog } from './editorwatchdog.js';
|
|
14
|
-
export { default as Watchdog } from './watchdog.js';
|
|
15
|
-
import './augmentation.js';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Traverses both structures to find out whether there is a reference that is shared between both structures.
|
|
11
|
-
*/
|
|
12
|
-
export default function areConnectedThroughProperties(target1: unknown, target2: unknown, excludedNodes?: Set<unknown>): boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module watchdog/utils/getsubnodes
|
|
11
|
-
*/
|
|
12
|
-
export default function getSubNodes(head: unknown, excludedProperties?: Set<unknown>): Set<unknown>;
|
package/dist/types/watchdog.d.ts
DELETED
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module watchdog/watchdog
|
|
11
|
-
*/
|
|
12
|
-
import type { CKEditorError } from 'ckeditor5/src/utils.js';
|
|
13
|
-
import type { EditorWatchdogRestartEvent } from './editorwatchdog.js';
|
|
14
|
-
import type { ContextWatchdogItemErrorEvent, ContextWatchdogItemRestartEvent } from './contextwatchdog.js';
|
|
15
|
-
/**
|
|
16
|
-
* An abstract watchdog class that handles most of the error handling process and the state of the underlying component.
|
|
17
|
-
*
|
|
18
|
-
* See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and how to use it.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export default abstract class Watchdog {
|
|
23
|
-
/**
|
|
24
|
-
* An array of crashes saved as an object with the following properties:
|
|
25
|
-
*
|
|
26
|
-
* * `message`: `String`,
|
|
27
|
-
* * `stack`: `String`,
|
|
28
|
-
* * `date`: `Number`,
|
|
29
|
-
* * `filename`: `String | undefined`,
|
|
30
|
-
* * `lineno`: `Number | undefined`,
|
|
31
|
-
* * `colno`: `Number | undefined`,
|
|
32
|
-
*/
|
|
33
|
-
readonly crashes: Array<{
|
|
34
|
-
message: string;
|
|
35
|
-
stack?: string;
|
|
36
|
-
date: number;
|
|
37
|
-
filename?: string;
|
|
38
|
-
lineno?: number;
|
|
39
|
-
colno?: number;
|
|
40
|
-
}>;
|
|
41
|
-
/**
|
|
42
|
-
* Specifies the state of the item watched by the watchdog. The state can be one of the following values:
|
|
43
|
-
*
|
|
44
|
-
* * `initializing` – Before the first initialization, and after crashes, before the item is ready.
|
|
45
|
-
* * `ready` – A state when the user can interact with the item.
|
|
46
|
-
* * `crashed` – A state when an error occurs. It quickly changes to `initializing` or `crashedPermanently`
|
|
47
|
-
* depending on how many and how frequent errors have been caught recently.
|
|
48
|
-
* * `crashedPermanently` – A state when the watchdog stops reacting to errors and keeps the item it is watching crashed,
|
|
49
|
-
* * `destroyed` – A state when the item is manually destroyed by the user after calling `watchdog.destroy()`.
|
|
50
|
-
*/
|
|
51
|
-
state: WatchdogState;
|
|
52
|
-
/**
|
|
53
|
-
* @see module:watchdog/watchdog~WatchdogConfig
|
|
54
|
-
*/
|
|
55
|
-
private _crashNumberLimit;
|
|
56
|
-
/**
|
|
57
|
-
* Returns the result of the `Date.now()` call. It can be overridden in tests to mock time as some popular
|
|
58
|
-
* approaches like `sinon.useFakeTimers()` do not work well with error handling.
|
|
59
|
-
*/
|
|
60
|
-
private _now;
|
|
61
|
-
/**
|
|
62
|
-
* @see module:watchdog/watchdog~WatchdogConfig
|
|
63
|
-
*/
|
|
64
|
-
private _minimumNonErrorTimePeriod;
|
|
65
|
-
/**
|
|
66
|
-
* Checks if the event error comes from the underlying item and restarts the item.
|
|
67
|
-
*/
|
|
68
|
-
private _boundErrorHandler;
|
|
69
|
-
/**
|
|
70
|
-
* The method responsible for restarting the watched item.
|
|
71
|
-
*/
|
|
72
|
-
protected abstract _restart(): Promise<unknown>;
|
|
73
|
-
/**
|
|
74
|
-
* Traverses the error context and the watched item to find out whether the error should
|
|
75
|
-
* be handled by the given item.
|
|
76
|
-
*
|
|
77
|
-
* @internal
|
|
78
|
-
*/
|
|
79
|
-
abstract _isErrorComingFromThisItem(error: CKEditorError): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* The watched item.
|
|
82
|
-
*
|
|
83
|
-
* @internal
|
|
84
|
-
*/
|
|
85
|
-
abstract get _item(): unknown;
|
|
86
|
-
/**
|
|
87
|
-
* A dictionary of event emitter listeners.
|
|
88
|
-
*/
|
|
89
|
-
private _listeners;
|
|
90
|
-
/**
|
|
91
|
-
* @param {module:watchdog/watchdog~WatchdogConfig} config The watchdog plugin configuration.
|
|
92
|
-
*/
|
|
93
|
-
constructor(config: WatchdogConfig);
|
|
94
|
-
/**
|
|
95
|
-
* Destroys the watchdog and releases the resources.
|
|
96
|
-
*/
|
|
97
|
-
destroy(): void;
|
|
98
|
-
/**
|
|
99
|
-
* Starts listening to a specific event name by registering a callback that will be executed
|
|
100
|
-
* whenever an event with a given name fires.
|
|
101
|
-
*
|
|
102
|
-
* Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.
|
|
103
|
-
*
|
|
104
|
-
* @param eventName The event name.
|
|
105
|
-
* @param callback A callback which will be added to event listeners.
|
|
106
|
-
*/
|
|
107
|
-
on<K extends keyof EventMap>(eventName: K, callback: EventCallback<K>): void;
|
|
108
|
-
/**
|
|
109
|
-
* Stops listening to the specified event name by removing the callback from event listeners.
|
|
110
|
-
*
|
|
111
|
-
* Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.
|
|
112
|
-
*
|
|
113
|
-
* @param eventName The event name.
|
|
114
|
-
* @param callback A callback which will be removed from event listeners.
|
|
115
|
-
*/
|
|
116
|
-
off(eventName: keyof EventMap, callback: unknown): void;
|
|
117
|
-
/**
|
|
118
|
-
* Fires an event with a given event name and arguments.
|
|
119
|
-
*
|
|
120
|
-
* Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.
|
|
121
|
-
*/
|
|
122
|
-
protected _fire<K extends keyof EventMap>(eventName: K, ...args: EventArgs<K>): void;
|
|
123
|
-
/**
|
|
124
|
-
* Starts error handling by attaching global error handlers.
|
|
125
|
-
*/
|
|
126
|
-
protected _startErrorHandling(): void;
|
|
127
|
-
/**
|
|
128
|
-
* Stops error handling by detaching global error handlers.
|
|
129
|
-
*/
|
|
130
|
-
protected _stopErrorHandling(): void;
|
|
131
|
-
/**
|
|
132
|
-
* Checks if an error comes from the watched item and restarts it.
|
|
133
|
-
* It reacts to {@link module:utils/ckeditorerror~CKEditorError `CKEditorError` errors} only.
|
|
134
|
-
*
|
|
135
|
-
* @fires error
|
|
136
|
-
* @param error Error.
|
|
137
|
-
* @param evt An error event.
|
|
138
|
-
*/
|
|
139
|
-
private _handleError;
|
|
140
|
-
/**
|
|
141
|
-
* Checks whether an error should be handled by the watchdog.
|
|
142
|
-
*
|
|
143
|
-
* @param error An error that was caught by the error handling process.
|
|
144
|
-
*/
|
|
145
|
-
private _shouldReactToError;
|
|
146
|
-
/**
|
|
147
|
-
* Checks if the watchdog should restart the underlying item.
|
|
148
|
-
*/
|
|
149
|
-
private _shouldRestart;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Fired when a new {@link module:utils/ckeditorerror~CKEditorError `CKEditorError`} error connected to the watchdog instance occurs
|
|
153
|
-
* and the watchdog will react to it.
|
|
154
|
-
*
|
|
155
|
-
* ```ts
|
|
156
|
-
* watchdog.on( 'error', ( evt, { error, causesRestart } ) => {
|
|
157
|
-
* console.log( 'An error occurred.' );
|
|
158
|
-
* } );
|
|
159
|
-
* ```
|
|
160
|
-
*
|
|
161
|
-
* @eventName ~Watchdog#error
|
|
162
|
-
*/
|
|
163
|
-
export type WatchdogErrorEvent = {
|
|
164
|
-
name: 'error';
|
|
165
|
-
args: [WatchdogErrorEventData];
|
|
166
|
-
};
|
|
167
|
-
/**
|
|
168
|
-
* The `error` event data.
|
|
169
|
-
*/
|
|
170
|
-
export type WatchdogErrorEventData = {
|
|
171
|
-
error: Error;
|
|
172
|
-
causesRestart: boolean;
|
|
173
|
-
};
|
|
174
|
-
/**
|
|
175
|
-
* Fired when the watchdog state changed.
|
|
176
|
-
*
|
|
177
|
-
* @eventName ~Watchdog#stateChange
|
|
178
|
-
*/
|
|
179
|
-
export type WatchdogStateChangeEvent = {
|
|
180
|
-
name: 'stateChange';
|
|
181
|
-
args: [];
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* The map of watchdog events.
|
|
185
|
-
*/
|
|
186
|
-
export interface EventMap {
|
|
187
|
-
stateChange: WatchdogStateChangeEvent;
|
|
188
|
-
error: WatchdogErrorEvent;
|
|
189
|
-
restart: EditorWatchdogRestartEvent;
|
|
190
|
-
itemError: ContextWatchdogItemErrorEvent;
|
|
191
|
-
itemRestart: ContextWatchdogItemRestartEvent;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Utility type that gets the arguments type for the given event.
|
|
195
|
-
*/
|
|
196
|
-
export type EventArgs<K extends keyof EventMap> = EventMap[K]['args'];
|
|
197
|
-
/**
|
|
198
|
-
* Utility type that gets the callback type for the given event.
|
|
199
|
-
*/
|
|
200
|
-
export type EventCallback<K extends keyof EventMap> = (evt: null, ...args: EventArgs<K>) => void;
|
|
201
|
-
/**
|
|
202
|
-
* The watchdog plugin configuration.
|
|
203
|
-
*/
|
|
204
|
-
export interface WatchdogConfig {
|
|
205
|
-
/**
|
|
206
|
-
* A threshold specifying the number of watched item crashes
|
|
207
|
-
* when the watchdog stops restarting the item in case of errors.
|
|
208
|
-
* After this limit is reached and the time between the last errors is shorter than `minimumNonErrorTimePeriod`,
|
|
209
|
-
* the watchdog changes its state to `crashedPermanently` and it stops restarting the item. This prevents an infinite restart loop.
|
|
210
|
-
*
|
|
211
|
-
* @default 3
|
|
212
|
-
*/
|
|
213
|
-
crashNumberLimit?: number;
|
|
214
|
-
/**
|
|
215
|
-
* An average number of milliseconds between the last watched item errors
|
|
216
|
-
* (defaults to 5000). When the period of time between errors is lower than that and the `crashNumberLimit` is also reached,
|
|
217
|
-
* the watchdog changes its state to `crashedPermanently` and it stops restarting the item. This prevents an infinite restart loop.
|
|
218
|
-
*
|
|
219
|
-
* @default 5000
|
|
220
|
-
*/
|
|
221
|
-
minimumNonErrorTimePeriod?: number;
|
|
222
|
-
/**
|
|
223
|
-
* A minimum number of milliseconds between saving the editor data internally (defaults to 5000).
|
|
224
|
-
* Note that for large documents this might impact the editor performance.
|
|
225
|
-
*
|
|
226
|
-
* @default 5000
|
|
227
|
-
*/
|
|
228
|
-
saveInterval?: number;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Specifies the state of the item watched by the watchdog.
|
|
232
|
-
*/
|
|
233
|
-
export type WatchdogState = 'initializing' | 'ready' | 'crashed' | 'crashedPermanently' | 'destroyed';
|