-
-
Notifications
You must be signed in to change notification settings - Fork 550
/
config.ts
38 lines (34 loc) · 1.2 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { AppState } from "@nteract/types";
/**
* Returns the theme of the notebook. Returns "light" if no theme is defined.
*
* @param state The state of the nteract application
*
* @returns The theme of the nteract application
*/
export const userTheme = (state: AppState): string =>
state.config.get("theme", "light");
/**
* Returns the theme of the notebook. Returns "light" if no theme is defined.
* This is an alias for the `userTheme` selector.
*
* @param state The state of the nteract application
*
* @returns The theme of the nteract application
*/
export const currentTheme = userTheme;
/**
* Returns the auto-save interval to be used in the notebook. Returns an
* interval around the two minute range if one is not provided in the config.
*/
export const autoSaveInterval = (state: AppState): number => {
const DEFAULT_AUTOSAVE_INTERVAL_MS = 120000;
return state.config.get("autoSaveInterval", DEFAULT_AUTOSAVE_INTERVAL_MS);
};
/**
* Returns the delete delay to be used in the notebook.
*/
export const deleteDelay = (state: AppState): number => {
const DEFAULT_DELETE_DELAY_MS = 10 * 1000;
return state.config.get("deleteDelay", DEFAULT_DELETE_DELAY_MS);
};