Skip to content

Commit b8a38b5

Browse files
committed
rewrite realm names to convention
1 parent 3601a07 commit b8a38b5

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

src/components/Outline.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {styled} from 'linaria/react'
33
import {useStore} from 'effector-react'
44

55
import {codeSetCursor} from '../editor'
6-
import {stats} from '../realm/state'
6+
import {$stats} from '../realm/state'
77

88
const OutlineWrapper = styled.div`
99
grid-column: 1 / span 1;
@@ -69,7 +69,7 @@ const OutlineSection = ({list, title}) => {
6969
}
7070

7171
export function Outline() {
72-
const {component, domain, event, effect, store} = useStore(stats)
72+
const {component, domain, event, effect, store} = useStore($stats)
7373
const isEmpty =
7474
event.length === 0 &&
7575
effect.length === 0 &&

src/realm/init.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import {
1818
realmRemoveListener,
1919
} from '.'
2020

21-
import {intervals, timeouts, listeners, stats} from './state'
21+
import {$intervals, $timeouts, $listeners, $stats} from './state'
2222

23-
listeners
23+
$listeners
2424
.on(realmListener, (list, record) => [...list, record])
2525
.on(realmRemoveListener, (list, {type, target, fn}) =>
2626
list.filter(record => {
@@ -42,7 +42,7 @@ listeners
4242
return []
4343
})
4444

45-
intervals
45+
$intervals
4646
.on(realmInterval, (state, id) => [...state, id])
4747
.on(realmClearInterval, (state, removed) =>
4848
state.filter(id => id !== removed),
@@ -52,36 +52,36 @@ intervals
5252
return []
5353
})
5454

55-
intervals.watch(changeSources, (state) => {
55+
$intervals.watch(changeSources, (state) => {
5656
for (const id of state) {
5757
global.clearInterval(id)
5858
}
5959
})
60-
intervals.watch(selectVersion, (state) => {
60+
$intervals.watch(selectVersion, (state) => {
6161
for (const id of state) {
6262
global.clearInterval(id)
6363
}
6464
})
6565

66-
timeouts
66+
$timeouts
6767
.on(realmTimeout, (state, id) => [...state, id])
6868
.on(realmClearTimeout, (state, removed) => state.filter(id => id !== removed))
6969
.on([changeSources, selectVersion], state => {
7070
return []
7171
})
7272

73-
timeouts.watch(changeSources, (state) => {
73+
$timeouts.watch(changeSources, (state) => {
7474
for (const id of state) {
7575
global.clearTimeout(id)
7676
}
7777
})
78-
timeouts.watch(selectVersion, (state) => {
78+
$timeouts.watch(selectVersion, (state) => {
7979
for (const id of state) {
8080
global.clearTimeout(id)
8181
}
8282
})
8383

84-
stats
84+
$stats
8585
.on(realmEvent, ({event, ...rest}, e) => {
8686
if (event.includes(e)) return
8787
return {
@@ -191,17 +191,17 @@ realmDomain.watch(domain => {
191191
if (getDomainName(event) !== domain.compositeName) return
192192
realmEvent(event)
193193
})
194-
domain.onCreateEffect(event => {
194+
domain.onCreateEffect(fx => {
195195
//TODO: wrong behaviour?
196-
if (getDomainName(event) !== domain.compositeName) return
197-
realmEffect(event)
196+
if (getDomainName(fx) !== domain.compositeName) return
197+
realmEffect(fx)
198198
})
199-
domain.onCreateStore(event => {
199+
domain.onCreateStore(store => {
200200
//TODO: wrong behaviour?
201-
if (getDomainName(event) !== domain.compositeName) return
202-
realmStore(event)
201+
if (getDomainName(store) !== domain.compositeName) return
202+
realmStore(store)
203203
})
204-
domain.onCreateDomain(event => realmDomain(event))
204+
domain.onCreateDomain(domain => realmDomain(domain))
205205
})
206206
function getDomainName(event) {
207207
if (event.parent) return event.parent.compositeName

src/realm/state.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {createStore, Event, Store, Effect, Domain} from 'effector'
22
import {StoreView} from 'effector-react'
33

4-
export const intervals = createStore<number[]>([])
5-
export const timeouts = createStore<number[]>([])
4+
export const $intervals = createStore<number[]>([])
5+
export const $timeouts = createStore<number[]>([])
66

77
export interface Listener {
88
type: string
@@ -11,7 +11,7 @@ export interface Listener {
1111
options?: any
1212
}
1313

14-
export const listeners = createStore<Listener[]>([])
14+
export const $listeners = createStore<Listener[]>([])
1515

1616
export interface Stats {
1717
event: Event<any>[]
@@ -21,7 +21,7 @@ export interface Stats {
2121
component: StoreView<any, any>[]
2222
}
2323

24-
export const stats = createStore<Stats>({
24+
export const $stats = createStore<Stats>({
2525
event: [],
2626
store: [],
2727
effect: [],

0 commit comments

Comments
 (0)