mirror of
https://github.com/nasa/openmct.git
synced 2025-06-12 20:28:14 +00:00
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
const NOTEBOOK_LOCAL_STORAGE = 'notebook-storage';
|
|
|
|
export function clearDefaultNotebook() {
|
|
window.localStorage.setItem(NOTEBOOK_LOCAL_STORAGE, null);
|
|
}
|
|
|
|
export function getDefaultNotebook() {
|
|
const notebookStorage = window.localStorage.getItem(NOTEBOOK_LOCAL_STORAGE);
|
|
|
|
return JSON.parse(notebookStorage);
|
|
}
|
|
|
|
export function setDefaultNotebook(domainObject, section, page) {
|
|
const notebookMeta = {
|
|
name: domainObject.name,
|
|
identifier: domainObject.identifier
|
|
};
|
|
|
|
const notebookStorage = {
|
|
notebookMeta,
|
|
section,
|
|
page
|
|
}
|
|
|
|
window.localStorage.setItem(NOTEBOOK_LOCAL_STORAGE, JSON.stringify(notebookStorage));
|
|
}
|
|
|
|
export function setDefaultNotebookSection(section) {
|
|
const notebookStorage = getDefaultNotebook();
|
|
|
|
notebookStorage.section = section;
|
|
window.localStorage.setItem(NOTEBOOK_LOCAL_STORAGE, JSON.stringify(notebookStorage));
|
|
|
|
}
|
|
|
|
export function setDefaultNotebookPage(page) {
|
|
const notebookStorage = getDefaultNotebook();
|
|
notebookStorage.page = page;
|
|
window.localStorage.setItem(NOTEBOOK_LOCAL_STORAGE, JSON.stringify(notebookStorage));
|
|
}
|