fcr-core
Version:
Core APIs for building online scenes
45 lines • 1.64 kB
JavaScript
import "core-js/modules/es.json.stringify.js";
import "core-js/modules/esnext.json.parse.js";
import { localStorage } from '../imports';
const STORAGE_KEY_ANNOTATION_BOARD_OPTIONS = 'annotation_board_options';
const STORAGE_KEY_WHITEBOARD_OPTIONS = 'whiteboard_options';
const STORAGE_KEY_BOARD_IP_LIST = 'board_ip_list';
export const setAnnotationBoardOptions = options => {
localStorage.setItem(STORAGE_KEY_ANNOTATION_BOARD_OPTIONS, JSON.stringify(options));
};
export const getAnnotationBoardOptions = () => {
const boardOptions = localStorage.getItem(STORAGE_KEY_ANNOTATION_BOARD_OPTIONS);
if (boardOptions) {
return JSON.parse(boardOptions);
}
return null;
};
export const clearAnnotationBoardOptions = () => {
localStorage.removeItem(STORAGE_KEY_ANNOTATION_BOARD_OPTIONS);
};
export const setWhiteboardOptions = options => {
localStorage.setItem(STORAGE_KEY_WHITEBOARD_OPTIONS, JSON.stringify(options));
};
export const getWhiteboardOptions = () => {
const boardOptions = localStorage.getItem(STORAGE_KEY_WHITEBOARD_OPTIONS);
if (boardOptions) {
return JSON.parse(boardOptions);
}
return null;
};
export const clearWhiteboardOptions = () => {
localStorage.removeItem(STORAGE_KEY_WHITEBOARD_OPTIONS);
};
export const setBoardIpList = ipList => {
localStorage.setItem(STORAGE_KEY_BOARD_IP_LIST, JSON.stringify(ipList));
};
export const getBoardIpList = () => {
const ipListStr = localStorage.getItem(STORAGE_KEY_BOARD_IP_LIST);
if (ipListStr) {
return JSON.parse(ipListStr);
}
return undefined;
};
export const clearBoardIpList = () => {
localStorage.removeItem(STORAGE_KEY_BOARD_IP_LIST);
};