Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 8d1100c

Browse files
committed
refactor(renaming): dispatch -> send, recv_event -> recieve
1 parent 4d4f73a commit 8d1100c

File tree

17 files changed

+60
-66
lines changed

17 files changed

+60
-66
lines changed

containers/AccountEditor/logic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
asyncErr,
66
buildLog,
77
$solver,
8-
dispatchEvent,
8+
send,
99
EVENT,
1010
ERR,
1111
TYPE,
@@ -23,7 +23,7 @@ const log = buildLog('L:AccountEditor')
2323
let store = null
2424

2525
export function goBack() {
26-
dispatchEvent(EVENT.PREVIEW, {
26+
send(EVENT.PREVIEW, {
2727
type: TYPE.PREVIEW_ACCOUNT_VIEW,
2828
})
2929
}
@@ -86,7 +86,7 @@ export const updateConfirm = () => {
8686
}
8787

8888
export function cancleEdit() {
89-
dispatchEvent(EVENT.PREVIEW_CLOSE)
89+
send(EVENT.PREVIEW_CLOSE)
9090
}
9191

9292
export function updateDone() {

containers/AccountViewer/logic.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
buildLog,
66
$solver,
77
ERR,
8-
dispatchEvent,
8+
send,
99
EVENT,
1010
TYPE,
1111
Global,
@@ -19,7 +19,7 @@ const log = buildLog('L:AccountViewer')
1919
/* eslint-enable no-unused-vars */
2020

2121
const sr71$ = new SR71({
22-
resv_event: [EVENT.LOGIN],
22+
recieve: [EVENT.LOGIN],
2323
})
2424

2525
let store = null
@@ -40,15 +40,15 @@ export const loadUser = user => {
4040
export const changeTheme = name => store.changeTheme(name)
4141

4242
export const editProfile = () =>
43-
dispatchEvent(EVENT.PREVIEW_OPEN, { type: TYPE.PREVIEW_ACCOUNT_EDIT })
43+
send(EVENT.PREVIEW_OPEN, { type: TYPE.PREVIEW_ACCOUNT_EDIT })
4444

4545
export const onLogout = () => {
4646
store.logout()
4747

4848
setTimeout(() => {
4949
Global.location.reload(false)
5050
}, 2000)
51-
// dispatchEvent(EVENT.LOGOUT)
51+
// send(EVENT.LOGOUT)
5252
}
5353

5454
const markLoading = (maybe = true) => store.markState({ loading: maybe })

containers/ArticleViwer/logic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { asyncRes, buildLog, EVENT, TYPE } from '@utils'
55
import S from './schema'
66

77
const sr71$ = new SR71({
8-
resv_event: [EVENT.PREVIEW_POST, EVENT.PREVIEW_CLOSED],
8+
recieve: [EVENT.PREVIEW_POST, EVENT.PREVIEW_CLOSED],
99
})
1010

1111
/* eslint-disable no-unused-vars */

containers/Comments/logic.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
$solver,
1010
scrollIntoEle,
1111
countWords,
12-
dispatchEvent,
12+
send,
1313
extractMentions,
1414
} from '@utils'
1515

@@ -196,20 +196,20 @@ export function toggleDislikeComment(comment) {
196196
}
197197

198198
export function onUploadImageDone(url) {
199-
dispatchEvent(EVENT.DRAFT_INSERT_SNIPPET, { data: `![](${url})` })
199+
send(EVENT.DRAFT_INSERT_SNIPPET, { data: `![](${url})` })
200200
}
201201

202202
export function insertQuote() {
203203
const data = '> '
204204

205-
dispatchEvent(EVENT.DRAFT_INSERT_SNIPPET, { data })
205+
send(EVENT.DRAFT_INSERT_SNIPPET, { data })
206206
}
207207

208208
export function insertCode() {
209209
const communityRaw = store.curCommunity.raw
210210
const data = `\`\`\`${communityRaw}\n\n\`\`\``
211211

212-
dispatchEvent(EVENT.DRAFT_INSERT_SNIPPET, { data })
212+
send(EVENT.DRAFT_INSERT_SNIPPET, { data })
213213
}
214214

215215
export function onMention(user) {

containers/CommunitiesBanner/logic.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import {
88
ERR,
99
EVENT,
1010
TYPE,
11-
dispatchEvent,
11+
send,
1212
} from '@utils'
1313

1414
import SR71 from 'utils/network/sr71'
1515

1616
import S from './schema'
1717

1818
const sr71$ = new SR71({
19-
resv_event: [EVENT.PREVIEW_CLOSE],
19+
recieve: [EVENT.PREVIEW_CLOSE],
2020
})
2121
/* eslint-disable no-unused-vars */
2222
const log = buildLog('L:communitiesBanner')
@@ -55,23 +55,23 @@ export const loadCategories = () =>
5555
export function onAdd(thread) {
5656
switch (thread) {
5757
case 'tags': {
58-
return dispatchEvent(EVENT.NAV_CREATE_TAG, {
58+
return send(EVENT.NAV_CREATE_TAG, {
5959
type: TYPE.PREVIEW_CREATE_TAG,
6060
})
6161
}
6262
case 'categories': {
63-
return dispatchEvent(EVENT.NAV_CREATE_CATEGORY, {
63+
return send(EVENT.NAV_CREATE_CATEGORY, {
6464
type: TYPE.PREVIEW_CREATE_CATEGORY,
6565
})
6666
}
6767
case 'threads': {
68-
return dispatchEvent(EVENT.NAV_CREATE_THREAD, {
68+
return send(EVENT.NAV_CREATE_THREAD, {
6969
type: TYPE.PREVIEW_CREATE_THREAD,
7070
})
7171
}
7272
default: {
7373
log('onAdd default: ', thread)
74-
return dispatchEvent(EVENT.NAV_CREATE_COMMUNITY, {
74+
return send(EVENT.NAV_CREATE_COMMUNITY, {
7575
type: TYPE.PREVIEW_CREATE_COMMUNITY,
7676
})
7777
}

containers/CommunitiesContent/logic.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import R from 'ramda'
22
import { message } from 'antd'
33
/* import Router from 'next/router' */
44

5+
import { PAGE_SIZE } from '@config'
6+
57
import {
68
asyncRes,
79
asyncErr,
@@ -14,15 +16,14 @@ import {
1416
ROUTE,
1517
scrollIntoEle,
1618
closePreviewer,
17-
dispatchEvent,
19+
send,
1820
} from '@utils'
1921

20-
import { PAGE_SIZE } from '@config'
2122
import SR71 from 'utils/network/sr71'
2223
import S from './schema'
2324

2425
const sr71$ = new SR71({
25-
resv_event: [
26+
recieve: [
2627
EVENT.LOGOUT,
2728
EVENT.LOGIN,
2829
EVENT.PREVIEW_CLOSE,
@@ -134,13 +135,13 @@ export function onEdit(record) {
134135
}
135136

136137
export const onEditCategory = record =>
137-
dispatchEvent(EVENT.NAV_UPDATE_CATEGORY, {
138+
send(EVENT.NAV_UPDATE_CATEGORY, {
138139
type: TYPE.PREVIEW_UPDATE_CATEGORY,
139140
data: record,
140141
})
141142

142143
export const onEditTag = record =>
143-
dispatchEvent(EVENT.NAV_UPDATE_TAG, {
144+
send(EVENT.NAV_UPDATE_TAG, {
144145
type: TYPE.PREVIEW_UPDATE_TAG,
145146
data: record,
146147
})
@@ -161,7 +162,7 @@ export function onDeleteCagegory(record) {
161162
}
162163

163164
export const setCommunity = (thread, source) =>
164-
dispatchEvent(EVENT.NAV_SET_COMMUNITY, {
165+
send(EVENT.NAV_SET_COMMUNITY, {
165166
type: TYPE.PREVIEW_SET_COMMUNITY,
166167
data: {
167168
source,
@@ -188,7 +189,7 @@ export const unsetThread = (communityId, thread) =>
188189
})
189190

190191
export const setThread = source =>
191-
dispatchEvent(EVENT.NAV_SET_THREAD, {
192+
send(EVENT.NAV_SET_THREAD, {
192193
type: TYPE.PREVIEW_SET_THREAD,
193194
data: source,
194195
})
@@ -200,13 +201,13 @@ export const unsetCategory = (communityId, category) =>
200201
})
201202

202203
export const setCategory = source =>
203-
dispatchEvent(EVENT.NAV_SET_CATEGORY, {
204+
send(EVENT.NAV_SET_CATEGORY, {
204205
type: TYPE.PREVIEW_SET_CATEGORY,
205206
data: source,
206207
})
207208

208209
export const setTag = (thread, source) =>
209-
dispatchEvent(EVENT.NAV_SET_TAG, {
210+
send(EVENT.NAV_SET_TAG, {
210211
type: TYPE.PREVIEW_SET_TAG,
211212
data: {
212213
thread,

containers/CommunityContent/logic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import SR71 from 'utils/network/sr71'
1717
import S from './schema'
1818

1919
const sr71$ = new SR71({
20-
resv_event: [EVENT.SIDEBAR_MENU_CHANGE],
20+
recieve: [EVENT.SIDEBAR_MENU_CHANGE],
2121
})
2222

2323
let sub$ = null

containers/Doraemon/logic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import SR71 from 'utils/network/sr71'
55
import {
66
buildLog,
77
Global,
8-
dispatchEvent,
8+
send,
99
asyncRes,
1010
asyncErr,
1111
$solver,
@@ -217,7 +217,7 @@ const doNavigate = () => {
217217
const { id } = store.activeSuggestion
218218
if (R.startsWith('user-raw', store.activeSuggestion.raw)) {
219219
hidePanel()
220-
return dispatchEvent(EVENT.PREVIEW_OPEN, {
220+
return send(EVENT.PREVIEW_OPEN, {
221221
type: TYPE.PREVIEW_USER_VIEW,
222222
data: { id },
223223
})

containers/Header/logic.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
asyncRes,
66
asyncErr,
77
buildLog,
8-
dispatchEvent,
8+
send,
99
EVENT,
1010
TYPE,
1111
/* Global, */
@@ -31,7 +31,7 @@ let sub$ = null
3131

3232
export function previewState() {
3333
// store.openPreview(type)
34-
dispatchEvent(EVENT.PREVIEW, {
34+
send(EVENT.PREVIEW, {
3535
type: TYPE.PREVIEW_ROOT_STORE,
3636
})
3737
}
@@ -47,19 +47,19 @@ export function signinGithub(code) {
4747
export const checkSesstionState = () => sr71$.query(S.sessionState, {})
4848

4949
export function previewAccount() {
50-
dispatchEvent(EVENT.PREVIEW, {
50+
send(EVENT.PREVIEW, {
5151
type: TYPE.PREVIEW_ACCOUNT_VIEW,
5252
data: { hello: 'world --- fuck' },
5353
})
5454
}
5555

5656
export function login() {
5757
log('do login')
58-
dispatchEvent(EVENT.LOGIN_PANEL)
58+
send(EVENT.LOGIN_PANEL)
5959
}
6060

6161
export function openPreview() {
62-
dispatchEvent(EVENT.PREVIEW, {
62+
send(EVENT.PREVIEW, {
6363
type: TYPE.PREVIEW_ACCOUNT_VIEW,
6464
data: { hello: 'world' },
6565
})

containers/PermissionEditor/logic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { PAGE_SIZE } from '@config'
1616
import S from './schema'
1717

1818
const sr71$ = new SR71({
19-
resv_event: [EVENT.PREVIEW_CLOSED],
19+
recieve: [EVENT.PREVIEW_CLOSED],
2020
})
2121
let sub$ = null
2222

0 commit comments

Comments
 (0)