@@ -15,17 +15,17 @@ import { querySync } from 'atomic-router';
1515### Basic example
1616
1717``` ts
18- import { createStore } from ' effector'
19- import { createRoute , querySync } from ' atomic-router'
18+ import { createStore } from ' effector' ;
19+ import { querySync } from ' atomic-router' ;
2020
21- import { controls } from ' @/shared/routing'
21+ import { controls } from ' @/shared/routing' ;
2222
23- const $utmSource = createStore (" " )
23+ const $utmSource = createStore (" " );
2424
2525querySync ({
2626 source: { utm_source: $utmSource },
27- controls
28- })
27+ controls ,
28+ });
2929```
3030
3131This will
@@ -37,20 +37,20 @@ This will
3737You can pass ` route ` param if you want this sync to work only for a specific route:
3838
3939``` ts
40- import { createStore } from ' effector'
41- import { createRoute , querySync } from ' atomic-router'
40+ import { createStore } from ' effector' ;
41+ import { createRoute , querySync } from ' atomic-router' ;
4242
43- import { controls } from ' @/shared/routing'
43+ import { controls } from ' @/shared/routing' ;
4444
45- const searchRoute = createRoute ()
45+ const searchRoute = createRoute ();
4646
47- const $q = createStore (" " )
47+ const $q = createStore (" " );
4848
4949querySync ({
5050 source: { q: $q },
51- route: searchRoute ,
52- controls
53- })
51+ route: searchRoute ,
52+ controls ,
53+ });
5454```
5555
5656### With a ` clock `
@@ -59,29 +59,29 @@ If we don't want to spam route updates, there's a `clock` parameter.
5959If it's passed, ` querySync ` will update route only when ` clock ` it's triggered:
6060
6161``` ts
62- import { createRoute , querySync } from ' atomic-router'
63- import { createStore , createEvent } from ' effector'
62+ import { createRoute , querySync } from ' atomic-router' ;
63+ import { createStore , createEvent } from ' effector' ;
6464
65- import { controls } from ' @/shared/routing'
65+ import { controls } from ' @/shared/routing' ;
6666
67- const canvasEditorRoute = createRoute ()
67+ const canvasEditorRoute = createRoute ();
6868
69- const canvasDragged = createEvent ()
70- const canvasDragEnded = createEvent ()
69+ const canvasDragged = createEvent ();
70+ const canvasDragEnded = createEvent ();
7171
72- const $x = createStore (' 0' )
73- const $y = createStore (' 0' )
72+ const $x = createStore (' 0' );
73+ const $y = createStore (' 0' );
7474
75- $x .on (canvasDragged , (_ , { x }) => x )
75+ $x .on (canvasDragged , (_ , { x }) => x );
7676
77- $y .on (canvasDragged , (_ , { y }) => y )
77+ $y .on (canvasDragged , (_ , { y }) => y );
7878
7979querySync ({
8080 source: { x: $x , y: $y },
8181 route: canvasEditorRoute ,
8282 clock: canvasDragEnded ,
83- controls
84- })
83+ controls ,
84+ });
8585```
8686
8787## ` cleanup ` parameter
@@ -97,10 +97,10 @@ querySync({
9797 // Strip empty params ('', 0, false, null)
9898 empty: true ,
9999 // Preserves params that should've been removed by irerelevant/empty params
100- preserve: [' utm_source' ]
100+ preserve: [' utm_source' ],
101101 },
102- controls
103- })
102+ controls ,
103+ });
104104```
105105
106106- ` cleanup ` is optional. Default strategy is ` { irrelevant: true, empty: false, preserve: [] } `
0 commit comments