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

Commit aa01021

Browse files
committed
chore: Merge branch 'rename/dispatch' into dev
2 parents a17fb84 + 5a384e7 commit aa01021

File tree

58 files changed

+161
-188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+161
-188
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 { TYPE, EVENT, ERR } from '@constant'
55
import {
66
buildLog,
77
asyncSuit,
8-
dispatchEvent,
8+
send,
99
cast,
1010
meteorState,
1111
updateEditing,
@@ -25,7 +25,7 @@ let store = null
2525
let sub$ = null
2626

2727
export const goBack = () =>
28-
dispatchEvent(EVENT.PREVIEW_OPEN, { type: TYPE.PREVIEW_ACCOUNT_VIEW })
28+
send(EVENT.PREVIEW_OPEN, { type: TYPE.PREVIEW_ACCOUNT_VIEW })
2929

3030
export const inputOnChange = R.curry((part, e) => updateEditing(store, part, e))
3131
/* eslint-disable no-unused-vars */
@@ -93,7 +93,7 @@ export const updateConfirm = () => {
9393
sr71$.mutate(S.updateProfile, args)
9494
}
9595

96-
export const cancleEdit = () => dispatchEvent(EVENT.PREVIEW_CLOSE)
96+
export const cancleEdit = () => send(EVENT.PREVIEW_CLOSE)
9797

9898
export const updateDone = () => {
9999
const editing = cast(updateFields, store.editUserData)

containers/AccountViewer/logic.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { useEffect } from 'react'
33

44
import { TYPE, EVENT, ERR } from '@constant'
5-
import { asyncSuit, buildLog, dispatchEvent, Global, errRescue } from '@utils'
5+
import { asyncSuit, buildLog, send, Global, errRescue } from '@utils'
66

77
import S from './schema'
88

@@ -11,7 +11,7 @@ const log = buildLog('L:AccountViewer')
1111

1212
const { SR71, $solver, asyncRes, asyncErr } = asyncSuit
1313
const sr71$ = new SR71({
14-
resv_event: [EVENT.LOGIN],
14+
recieve: [EVENT.LOGIN],
1515
})
1616

1717
let store = null
@@ -29,19 +29,19 @@ export const loadUser = user => {
2929

3030
export const changeTheme = name => {
3131
store.changeTheme(name)
32-
dispatchEvent(EVENT.SET_C11N, { data: { theme: name } })
32+
send(EVENT.SET_C11N, { data: { theme: name } })
3333
}
3434

3535
export const editProfile = () =>
36-
dispatchEvent(EVENT.PREVIEW_OPEN, { type: TYPE.PREVIEW_ACCOUNT_EDIT })
36+
send(EVENT.PREVIEW_OPEN, { type: TYPE.PREVIEW_ACCOUNT_EDIT })
3737

3838
export const onLogout = () => {
3939
store.logout()
4040

4141
setTimeout(() => {
4242
Global.location.reload(false)
4343
}, 2000)
44-
// dispatchEvent(EVENT.LOGOUT)
44+
// send(EVENT.LOGOUT)
4545
}
4646

4747
// ###############################

containers/ArticleAuthorCard/logic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { useEffect } from 'react'
33

44
import { EVENT, ERR } from '@constant'
5-
import { asyncSuit, buildLog, dispatchEvent, errRescue } from '@utils'
5+
import { asyncSuit, buildLog, send, errRescue } from '@utils'
66

77
import S from './schema'
88

@@ -24,7 +24,7 @@ export const loadUser = user => {
2424
}
2525

2626
export const onListUsers = (type, data) =>
27-
dispatchEvent(EVENT.USER_LISTER_OPEN, { type, data })
27+
send(EVENT.USER_LISTER_OPEN, { type, data })
2828

2929
export const onFollow = userId => {
3030
store.markState({ following: true })

containers/ArticleBanner/logic.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import R from 'ramda'
22
import { useEffect } from 'react'
33

44
import { TYPE, EVENT, ERR, THREAD } from '@constant'
5-
import { asyncSuit, buildLog, dispatchEvent, errRescue } from '@utils'
5+
import { asyncSuit, buildLog, send, errRescue } from '@utils'
66

77
import S from './schema'
88

@@ -11,7 +11,7 @@ const log = buildLog('L:ArticleBanner')
1111

1212
const { SR71, $solver, asyncRes, asyncErr } = asyncSuit
1313
const sr71$ = new SR71({
14-
resv_event: [EVENT.REFRESH_REACTIONS],
14+
recieve: [EVENT.REFRESH_REACTIONS],
1515
})
1616

1717
let sub$ = null
@@ -26,7 +26,7 @@ export const onReaction = (action, userDid, { id }) => {
2626
/* log('onReaction thread: ', thread) */
2727
if (action === TYPE.FAVORITE) {
2828
// call favoriteSetter
29-
return dispatchEvent(EVENT.SET_FAVORITE_CONTENT, {
29+
return send(EVENT.SET_FAVORITE_CONTENT, {
3030
data: { thread },
3131
})
3232
}
@@ -40,7 +40,7 @@ export const onReaction = (action, userDid, { id }) => {
4040
}
4141

4242
export const onListReactionUsers = (type, data) =>
43-
dispatchEvent(EVENT.USER_LISTER_OPEN, {
43+
send(EVENT.USER_LISTER_OPEN, {
4444
type,
4545
data: { ...data, thread: store.activeThread },
4646
})

containers/ArticleBodyHeader/logic.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ import R from 'ramda'
22
import { useEffect } from 'react'
33

44
import { TYPE, EVENT, ERR, THREAD } from '@constant'
5-
import {
6-
asyncSuit,
7-
buildLog,
8-
dispatchEvent,
9-
closePreviewer,
10-
errRescue,
11-
} from '@utils'
5+
import { asyncSuit, buildLog, send, closePreviewer, errRescue } from '@utils'
126

137
import S from './schema'
148

@@ -35,17 +29,17 @@ export const onEdit = thread => {
3529
break
3630

3731
case THREAD.REPO:
38-
return dispatchEvent(EVENT.SYNC_REPO)
32+
return send(EVENT.SYNC_REPO)
3933

4034
default: {
4135
type = TYPE.PREVIEW_POST_EDIT
4236
}
4337
}
4438

45-
dispatchEvent(EVENT.PREVIEW_OPEN, { type, data })
39+
send(EVENT.PREVIEW_OPEN, { type, data })
4640
}
4741

48-
export const onCommunitySet = () => dispatchEvent(EVENT.COMMUNITY_MIRROR)
42+
export const onCommunitySet = () => send(EVENT.COMMUNITY_MIRROR)
4943

5044
export const onPin = thread => {
5145
const args = {
@@ -163,7 +157,7 @@ const backToParentThread = () => {
163157
REFRESH_EVENT = EVENT.REFRESH_REPOS
164158
}
165159

166-
dispatchEvent(REFRESH_EVENT)
160+
send(REFRESH_EVENT)
167161
closePreviewer()
168162
store.setViewing({ post: {}, job: {}, repo: {}, video: {} })
169163
}

containers/ArticleViewerHeader/logic.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import R from 'ramda'
22
import { useEffect } from 'react'
33

44
import { TYPE, EVENT, ERR, THREAD } from '@constant'
5-
import { asyncSuit, buildLog, dispatchEvent, errRescue } from '@utils'
5+
import { asyncSuit, buildLog, send, errRescue } from '@utils'
66

77
import S from './schema'
88

@@ -13,7 +13,7 @@ const log = buildLog('L:ArticleViewerHeader')
1313
// user set it from FavoriteSetter
1414
const { SR71, $solver, asyncRes, asyncErr } = asyncSuit
1515
const sr71$ = new SR71({
16-
resv_event: [EVENT.REFRESH_REACTIONS],
16+
recieve: [EVENT.REFRESH_REACTIONS],
1717
})
1818

1919
let sub$ = null
@@ -29,7 +29,7 @@ export const onReaction = (action, userDid, { id }) => {
2929
/* log('onReaction thread: ', thread) */
3030
if (action === TYPE.FAVORITE) {
3131
// call favoriteSetter
32-
return dispatchEvent(EVENT.SET_FAVORITE_CONTENT, {
32+
return send(EVENT.SET_FAVORITE_CONTENT, {
3333
data: { thread },
3434
})
3535
}
@@ -43,7 +43,7 @@ export const onReaction = (action, userDid, { id }) => {
4343
}
4444

4545
export const onListReactionUsers = (type, data) =>
46-
dispatchEvent(EVENT.USER_LISTER_OPEN, {
46+
send(EVENT.USER_LISTER_OPEN, {
4747
type,
4848
data: { ...data, thread: store.activeThread },
4949
})

containers/Cashier/logic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Global,
99
holdPage,
1010
errorForHuman,
11-
dispatchEvent,
11+
send,
1212
errRescue,
1313
} from '@utils'
1414

@@ -17,7 +17,7 @@ import S from './schema'
1717
const { SR71, $solver, asyncRes, asyncErr } = asyncSuit
1818

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

@@ -82,7 +82,7 @@ const DataSolver = [
8282
title: 'CPS 团队感谢您的支持!',
8383
msg: '我们会尽快为您办理',
8484
})
85-
dispatchEvent(EVENT.NEW_BILLS)
85+
send(EVENT.NEW_BILLS)
8686
},
8787
},
8888
]

containers/CheatsheetThread/logic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const log = buildLog('L:CheatsheetThread')
1313

1414
const { SR71, $solver, asyncRes, asyncErr } = asyncSuit
1515
const sr71$ = new SR71({
16-
resv_event: [EVENT.COMMUNITY_CHANGE, EVENT.TABBER_CHANGE],
16+
recieve: [EVENT.COMMUNITY_CHANGE, EVENT.TABBER_CHANGE],
1717
})
1818

1919
let sub$ = null

containers/Comments/logic.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
buildLog,
99
scrollIntoEle,
1010
countWords,
11-
dispatchEvent,
11+
send,
1212
extractMentions,
1313
errRescue,
1414
BStore,
@@ -225,16 +225,16 @@ export const toggleDislikeComment = comment => {
225225
}
226226

227227
export const onUploadImageDone = url =>
228-
dispatchEvent(EVENT.DRAFT_INSERT_SNIPPET, { data: `![](${url})` })
228+
send(EVENT.DRAFT_INSERT_SNIPPET, { data: `![](${url})` })
229229

230230
export const insertQuote = () =>
231-
dispatchEvent(EVENT.DRAFT_INSERT_SNIPPET, { data: '> ' })
231+
send(EVENT.DRAFT_INSERT_SNIPPET, { data: '> ' })
232232

233233
export const insertCode = () => {
234234
const communityRaw = store.curCommunity.raw
235235
const data = `\`\`\`${communityRaw}\n\n\`\`\``
236236

237-
dispatchEvent(EVENT.DRAFT_INSERT_SNIPPET, { data })
237+
send(EVENT.DRAFT_INSERT_SNIPPET, { data })
238238
}
239239

240240
export const onMention = user => store.addReferUser(user)

containers/CommunitiesBanner/logic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect } from 'react'
22

33
import { EVENT } from '@constant'
4-
import { asyncSuit, buildLog, dispatchEvent, updateEditing } from '@utils'
4+
import { asyncSuit, buildLog, send, updateEditing } from '@utils'
55

66
import S from './schema'
77

@@ -19,7 +19,7 @@ export const loadCategories = () =>
1919

2020
export const searchOnChange = e => {
2121
updateEditing(store, 'searchValue', e)
22-
dispatchEvent(EVENT.REFRESH_COMMUNITIES, {
22+
send(EVENT.REFRESH_COMMUNITIES, {
2323
type: 'search',
2424
data: e.target.value,
2525
})
@@ -28,7 +28,7 @@ export const searchOnChange = e => {
2828
export const tabOnChange = activeTab => {
2929
store.markRoute({ subPath: activeTab })
3030
store.markState({ activeTab })
31-
dispatchEvent(EVENT.REFRESH_COMMUNITIES, { data: activeTab })
31+
send(EVENT.REFRESH_COMMUNITIES, { data: activeTab })
3232
}
3333
// ###############################
3434
// Data & Error handlers

0 commit comments

Comments
 (0)