chore: build a simple store

based on localstorage
This commit is contained in:
2018-09-06 18:15:18 -07:00
parent 5665bdeaa9
commit a15deb9602

View File

@@ -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 => {