blob: 32a9e7e2f055bd59af00fbebb82de3f805f881b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import { selectCommentBox } from './utils';
import { sessionStorage } from '../shared';
const getSavedComment = () => sessionStorage.getItem('comment') || '';
const saveComment = () => {
const currentComment = selectCommentBox();
// This may be added to any view via top-level beforeunload listener
// so let's skip if it does not apply
if (currentComment && currentComment.value) {
sessionStorage.setItem('comment', currentComment.value);
}
};
const clearSavedComment = () => {
sessionStorage.removeItem('comment');
};
export { getSavedComment, saveComment, clearSavedComment };
|