UNPKG

1.75 kBTypeScriptView Raw
1import { DocumentRegistry } from '@jupyterlab/docregistry';
2import { IDisposable } from '@lumino/disposable';
3/**
4 * A class that manages the auto saving of a document.
5 *
6 * #### Notes
7 * Implements https://github.com/ipython/ipython/wiki/IPEP-15:-Autosaving-the-IPython-Notebook.
8 */
9export declare class SaveHandler implements IDisposable {
10 /**
11 * Construct a new save handler.
12 */
13 constructor(options: SaveHandler.IOptions);
14 /**
15 * The save interval used by the timer (in seconds).
16 */
17 get saveInterval(): number;
18 set saveInterval(value: number);
19 /**
20 * Get whether the handler is active.
21 */
22 get isActive(): boolean;
23 /**
24 * Get whether the save handler is disposed.
25 */
26 get isDisposed(): boolean;
27 /**
28 * Dispose of the resources used by the save handler.
29 */
30 dispose(): void;
31 /**
32 * Start the autosaver.
33 */
34 start(): void;
35 /**
36 * Stop the autosaver.
37 */
38 stop(): void;
39 /**
40 * Set the timer.
41 */
42 private _setTimer;
43 /**
44 * Handle an autosave timeout.
45 */
46 private _save;
47 private _autosaveTimer;
48 private _minInterval;
49 private _interval;
50 private _context;
51 private _isActive;
52 private _inDialog;
53 private _isDisposed;
54 private _multiplier;
55}
56/**
57 * A namespace for `SaveHandler` statics.
58 */
59export declare namespace SaveHandler {
60 /**
61 * The options used to create a save handler.
62 */
63 interface IOptions {
64 /**
65 * The context associated with the file.
66 */
67 context: DocumentRegistry.Context;
68 /**
69 * The minimum save interval in seconds (default is two minutes).
70 */
71 saveInterval?: number;
72 }
73}