chore: build a simple store
based on localstorage
This commit is contained in:
@@ -178,7 +178,7 @@
|
||||
<script>
|
||||
// lunr = window.lunr
|
||||
// mitt = window.mitt
|
||||
(function ({ mitt, lunr }, data) {
|
||||
(function ({ mitt, lunr, localStorage }, data) {
|
||||
const emitter = mitt();
|
||||
const stringAscending = (a, b) => {
|
||||
const aa = a.toLowerCase();
|
||||
@@ -189,6 +189,10 @@
|
||||
|
||||
// helpers
|
||||
const getMultiValues = node => Array.from(node.selectedOptions).map(o => o.value);
|
||||
const store = {
|
||||
get: id => JSON.parse(localStorage.getItem(id)),
|
||||
set: (id, val) => localStorage.setItem(id, JSON.stringify(val)),
|
||||
};
|
||||
|
||||
// vue helpers
|
||||
Vue.filter('capitalize', value => {
|
||||
|
||||
Reference in New Issue
Block a user