Renaming of stores to better match purpose

This commit is contained in:
Knut Sveidqvist
2019-11-23 16:05:11 +01:00
parent 9f0fd20196
commit ede4016e7d
12 changed files with 23 additions and 23 deletions
-1
View File
@@ -17,7 +17,6 @@
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-153180559-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
+3
View File
@@ -0,0 +1,3 @@
import { writable } from 'svelte/store';
export const codeErrorStore = writable(undefined);
+4 -4
View File
@@ -1,6 +1,6 @@
<script>
import { codeStore, updateCodeStore } from '../code-store.js';
import { configStore } from '../config-store.js';
import { configErrorStore } from '../config-error-store.js';
import { onMount } from 'svelte';
import {push, pop, replace} from 'svelte-spa-router'
import { Base64 } from 'js-base64'
@@ -30,13 +30,13 @@ const handleConfUpdate = conf => {
let newState = { code, mermaid: JSON.parse(conf) };
oldConf = newState.mermaid;
updateCodeStore(newState);
configStore.set(undefined);
configErrorStore.set(undefined);
const model = edit.getModel();
// model.setValue(conf);
// model.dispose();
} catch(e) {
console.log('Error in parsed', e);
configStore.set(e);
configErrorStore.set(e);
const str = JSON.stringify({ code, mermaid: oldConf });
push('/edit/' + Base64.encode(str))
}
@@ -73,7 +73,7 @@ const unsubscribe = codeStore.subscribe( state => {
initEditor(monaco);
const unsubscribeError = configStore.subscribe( _error => {
const unsubscribeError = configErrorStore.subscribe( _error => {
// console.log('Error ideintified' + _error.toString());
if(_error) {
error = _error.toString();
+4 -4
View File
@@ -1,6 +1,6 @@
<script>
import { codeStore, updateCodeStore } from '../code-store.js';
import { errorStore } from '../error-store.js';
import { codeErrorStore } from '../code-error-store.js';
import { onMount } from 'svelte';
import {push, pop, replace} from 'svelte-spa-router'
import { Base64 } from 'js-base64'
@@ -29,11 +29,11 @@ const handleCodeUpdate = code => {
edit.deltaDecorations(decor, []);
});
errorStore.set(undefined);
codeErrorStore.set(undefined);
const model = edit.getModel();
} catch(e) {
if(e) {
errorStore.set(e);
codeErrorStore.set(e);
console.log('Error in parsed', e.hash);
const str = JSON.stringify({ code: code, mermaid: conf });
push('/edit/' + Base64.encode(str))
@@ -75,7 +75,7 @@ const unsubscribe = codeStore.subscribe( state => {
}
});
const unsubscribeError = errorStore.subscribe( _error => {
const unsubscribeError = codeErrorStore.subscribe( _error => {
if(_error) {
error = true;
} else {
+2 -2
View File
@@ -1,5 +1,5 @@
<script>
import { errorStore } from '../error-store.js';
import { codeErrorStore } from '../code-error-store.js';
import { onMount } from 'svelte';
onMount(async () => {
@@ -16,7 +16,7 @@ onMount(async () => {
export let errorText = '';
// const unsubscribeError = errorStore.subscribe( _error => {
// const unsubscribeError = codeErrorStore.subscribe( _error => {
// if(typeof _error === 'undefined') {
// classes = 'invisible';
// error = {};
+1 -1
View File
@@ -1,5 +1,5 @@
<script>
import { errorStore } from '../error-store.js';
import { codeErrorStore } from '../code-error-store.js';
import {link} from 'svelte-spa-router';
import { Base64 } from 'js-base64'
import { onMount } from 'svelte';
+4 -4
View File
@@ -1,7 +1,7 @@
<script>
import { codeStore } from '../code-store.js';
import { errorStore } from '../error-store.js';
import { configStore } from '../config-store.js';
import { codeErrorStore } from '../code-error-store.js';
import { configErrorStore } from '../config-error-store.js';
import { onMount } from 'svelte';
import mermaid from '@mermaid-js/mermaid';
@@ -81,7 +81,7 @@ let insertSvg = function(svgCode, bindFunctions){
}
});
const unsubscribeError = errorStore.subscribe( _error => {
const unsubscribeError = codeErrorStore.subscribe( _error => {
if(typeof _error === 'undefined') {
codeClasses = '';
} else {
@@ -89,7 +89,7 @@ let insertSvg = function(svgCode, bindFunctions){
console.log('code error: ', _error);
}
});
const unsubscribeConfigError = configStore.subscribe( _error => {
const unsubscribeConfigError = configErrorStore.subscribe( _error => {
if(typeof _error === 'undefined') {
configClasses = '';
} else {
+3
View File
@@ -0,0 +1,3 @@
import { writable } from 'svelte/store';
export const configErrorStore = writable(undefined);
-3
View File
@@ -1,3 +0,0 @@
import { writable } from 'svelte/store';
export const configStore = writable(undefined);
-3
View File
@@ -1,3 +0,0 @@
import { writable } from 'svelte/store';
export const errorStore = writable(undefined);
+1 -1
View File
@@ -8,7 +8,7 @@ import Links from '../components/Links.svelte';
import { fromUrl } from '../code-store.js';
onMount(async () => {
console.log('Data = ', params.data)
ga('send', 'pageview');
fromUrl(params.data);
});
+1
View File
@@ -6,6 +6,7 @@ import { fromUrl } from '../code-store.js';
onMount(async () => {
fromUrl(params.data);
ga('send', 'pageview');
});
export let code = '';