@@ -69,8 +69,8 @@ interface Events extends StoreonEvents<State> {
69
69
}
70
70
71
71
let counter = (store : Store <State >) => {
72
- store .on (" @init" , () => ({ count: 0 }))
73
- store .on (" inc" , ({ count }) => ({ count: count + 1 }))
72
+ store .on (' @init' , () => ({ count: 0 }))
73
+ store .on (' inc' , ({ count }) => ({ count: count + 1 }))
74
74
store .on (' set' , (_ , event ) => ({ count: event }))
75
75
};
76
76
@@ -99,35 +99,35 @@ Import `getStore` function from our `@storeon/svelte` module and use it for gett
99
99
100
100
``` html
101
101
<script >
102
- import { getStore } from " @storeon/svelte" ;
102
+ import { getStore } from ' @storeon/svelte' ;
103
103
104
- const { count , dispatch } = getStore (" count" );
104
+ const { count , dispatch } = getStore (' count' );
105
105
106
106
function increment () {
107
- dispatch (" inc" );
107
+ dispatch (' inc' );
108
108
}
109
109
</script >
110
110
111
111
<h1 >The count is {$count}</h1 >
112
112
113
- <button on:click =" {increment}" >+</button >
113
+ <button on:click ={increment} >+</button >
114
114
```
115
115
Using typescript you can pass ` State ` and ` Events ` interfaces to ` getStore ` function to be full type safe
116
116
``` html
117
117
<script lang =" typescript" >
118
- import { getStore } from " @storeon/svelte" ;
118
+ import { getStore } from ' @storeon/svelte' ;
119
119
import { State , Events } from ' ./store'
120
120
121
- const { count , dispatch } = getStore< State, Events> (" count" );
121
+ const { count , dispatch } = getStore< State, Events> (' count' );
122
122
123
123
function increment () {
124
- dispatch (" inc" );
124
+ dispatch (' inc' );
125
125
}
126
126
</script >
127
127
128
128
<h1 >The count is {$count}</h1 >
129
129
130
- <button on:click =" {increment}" >+</button >
130
+ <button on:click ={increment} >+</button >
131
131
```
132
132
133
133
## Usage with [ @storeon/router ] ( https://github.com/storeon/router )
@@ -136,7 +136,7 @@ If you want to use the @storeon/svelte with the `@storeon/router` you should imp
136
136
#### ` store.js `
137
137
``` js
138
138
import createStore from ' storeon'
139
- import { createRouter } from " @storeon/router" ;
139
+ import { createRouter } from ' @storeon/router' ;
140
140
141
141
const store = createStore ([
142
142
createRouter ([
@@ -162,8 +162,8 @@ And use it like:
162
162
#### ` Child.svelte `
163
163
``` html
164
164
<script >
165
- import { getStore } from " @storeon/svelte" ;
166
- import router from " @storeon/router"
165
+ import { getStore } from ' @storeon/svelte' ;
166
+ import router from ' @storeon/router'
167
167
168
168
const { [router .key ]: route } = getStore (router .key )
169
169
</script >
0 commit comments