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

Commit 6d6c39f

Browse files
committed
chore: Merge branch 'renaming' into dev
2 parents 4d4f73a + d7d6401 commit 6d6c39f

File tree

39 files changed

+279
-433
lines changed

39 files changed

+279
-433
lines changed

containers/AccountEditor/logic.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import R from 'ramda'
22

33
import {
4-
asyncRes,
5-
asyncErr,
4+
asyncSuit,
65
buildLog,
7-
$solver,
8-
dispatchEvent,
6+
send,
97
EVENT,
108
ERR,
119
TYPE,
1210
meteorState,
1311
} from '@utils'
14-
import SR71 from 'utils/network/sr71'
12+
1513
import S from './schema'
1614

15+
const { SR71, $solver, asyncRes, asyncErr } = asyncSuit
1716
const sr71$ = new SR71()
1817

1918
/* eslint-disable no-unused-vars */
@@ -23,7 +22,7 @@ const log = buildLog('L:AccountEditor')
2322
let store = null
2423

2524
export function goBack() {
26-
dispatchEvent(EVENT.PREVIEW, {
25+
send(EVENT.PREVIEW, {
2726
type: TYPE.PREVIEW_ACCOUNT_VIEW,
2827
})
2928
}
@@ -86,7 +85,7 @@ export const updateConfirm = () => {
8685
}
8786

8887
export function cancleEdit() {
89-
dispatchEvent(EVENT.PREVIEW_CLOSE)
88+
send(EVENT.PREVIEW_CLOSE)
9089
}
9190

9291
export function updateDone() {

containers/AccountViewer/logic.js

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
// import R from 'ramda'
2-
import {
3-
asyncRes,
4-
asyncErr,
5-
buildLog,
6-
$solver,
7-
ERR,
8-
dispatchEvent,
9-
EVENT,
10-
TYPE,
11-
Global,
12-
} from '@utils'
13-
14-
import SR71 from 'utils/network/sr71'
2+
import { asyncSuit, buildLog, ERR, send, EVENT, TYPE, Global } from '@utils'
3+
154
import S from './schema'
165

176
/* eslint-disable no-unused-vars */
187
const log = buildLog('L:AccountViewer')
198
/* eslint-enable no-unused-vars */
209

10+
const { SR71, $solver, asyncRes, asyncErr } = asyncSuit
2111
const sr71$ = new SR71({
22-
resv_event: [EVENT.LOGIN],
12+
recieve: [EVENT.LOGIN],
2313
})
2414

2515
let store = null
@@ -40,15 +30,15 @@ export const loadUser = user => {
4030
export const changeTheme = name => store.changeTheme(name)
4131

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

4535
export const onLogout = () => {
4636
store.logout()
4737

4838
setTimeout(() => {
4939
Global.location.reload(false)
5040
}, 2000)
51-
// dispatchEvent(EVENT.LOGOUT)
41+
// send(EVENT.LOGOUT)
5242
}
5343

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

containers/ArticleViwer/logic.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import R from 'ramda'
22

3-
import SR71 from 'utils/network/sr71'
4-
import { asyncRes, buildLog, EVENT, TYPE } from '@utils'
3+
import { asyncSuit, buildLog, EVENT, TYPE } from '@utils'
54
import S from './schema'
65

7-
const sr71$ = new SR71({
8-
resv_event: [EVENT.PREVIEW_POST, EVENT.PREVIEW_CLOSED],
9-
})
10-
116
/* eslint-disable no-unused-vars */
127
const log = buildLog('L:ArticleViwer')
138
/* eslint-enable no-unused-vars */
149

10+
const { SR71, asyncRes } = asyncSuit
11+
const sr71$ = new SR71({
12+
recieve: [EVENT.PREVIEW_POST, EVENT.PREVIEW_CLOSED],
13+
})
14+
1515
let store = null
1616
let sub$ = null
1717

containers/Banner/logic.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// import R from 'ramda'
22

3-
import { buildLog, $solver } from '@utils'
4-
import SR71 from 'utils/network/sr71'
5-
6-
const sr71$ = new SR71()
7-
let sub$ = null
3+
import { asyncSuit, buildLog, $solver } from '@utils'
84

95
/* eslint-disable no-unused-vars */
106
const log = buildLog('L:Banner')
117
/* eslint-enable no-unused-vars */
128

9+
const { SR71 } = asyncSuit
10+
const sr71$ = new SR71()
11+
12+
let sub$ = null
1313
let store = null
1414

1515
export function someMethod() {}

containers/CategoryEditor/logic.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import R from 'ramda'
22

3-
import { asyncRes, TYPE, buildLog, closePreviewer, $solver, cast } from '@utils'
4-
import SR71 from 'utils/network/sr71'
3+
import { asyncSuit, TYPE, buildLog, closePreviewer, cast } from '@utils'
54
import S from './schema'
65

7-
const sr71$ = new SR71()
8-
let sub$ = null
9-
106
/* eslint-disable no-unused-vars */
117
const log = buildLog('L:CategoryEditor')
128
/* eslint-enable no-unused-vars */
139

10+
const { SR71, asyncRes, $solver } = asyncSuit
11+
const sr71$ = new SR71()
12+
13+
let sub$ = null
1414
let store = null
1515

1616
export const profileChange = R.curry((thread, e) =>

containers/CategorySetter/logic.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import R from 'ramda'
22

3-
import { buildLog, $solver, TYPE, asyncRes, closePreviewer } from '@utils'
3+
import { asyncSuit, buildLog, TYPE, closePreviewer } from '@utils'
44
import { PAGE_SIZE } from '@config'
55

6-
import SR71 from 'utils/network/sr71'
76
import S from './schema'
87

9-
const sr71$ = new SR71()
10-
let sub$ = null
11-
128
/* eslint-disable no-unused-vars */
139
const log = buildLog('L:CategorySetter')
1410
/* eslint-enable no-unused-vars */
1511

12+
const { SR71, asyncRes, $solver } = asyncSuit
13+
const sr71$ = new SR71()
14+
let sub$ = null
15+
1616
let store = null
1717

1818
const commonFilter = page => {

containers/Comments/logic.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
import R from 'ramda'
22
import {
3-
asyncRes,
4-
asyncErr,
3+
asyncSuit,
54
buildLog,
65
EVENT,
76
ERR,
87
TYPE,
9-
$solver,
108
scrollIntoEle,
119
countWords,
12-
dispatchEvent,
10+
send,
1311
extractMentions,
1412
} from '@utils'
1513

1614
import { PAGE_SIZE } from '@config'
17-
import SR71 from 'utils/network/sr71'
1815
import S from './schema'
1916

20-
const sr71$ = new SR71()
21-
let sub$ = null
22-
2317
/* eslint-disable no-unused-vars */
2418
const log = buildLog('L:Comments')
2519
/* eslint-enable no-unused-vars */
2620

21+
const { SR71, asyncRes, asyncErr, $solver } = asyncSuit
22+
const sr71$ = new SR71()
23+
24+
let sub$ = null
2725
let store = null
2826

2927
/* DESC_INSERTED, ASC_INSERTED */
@@ -196,20 +194,20 @@ export function toggleDislikeComment(comment) {
196194
}
197195

198196
export function onUploadImageDone(url) {
199-
dispatchEvent(EVENT.DRAFT_INSERT_SNIPPET, { data: `![](${url})` })
197+
send(EVENT.DRAFT_INSERT_SNIPPET, { data: `![](${url})` })
200198
}
201199

202200
export function insertQuote() {
203201
const data = '> '
204202

205-
dispatchEvent(EVENT.DRAFT_INSERT_SNIPPET, { data })
203+
send(EVENT.DRAFT_INSERT_SNIPPET, { data })
206204
}
207205

208206
export function insertCode() {
209207
const communityRaw = store.curCommunity.raw
210208
const data = `\`\`\`${communityRaw}\n\n\`\`\``
211209

212-
dispatchEvent(EVENT.DRAFT_INSERT_SNIPPET, { data })
210+
send(EVENT.DRAFT_INSERT_SNIPPET, { data })
213211
}
214212

215213
export function onMention(user) {

containers/CommunitiesBanner/logic.js

+10-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
// import R from 'ramda'
22
// import Router from 'next/router'
3-
import {
4-
asyncRes,
5-
asyncErr,
6-
buildLog,
7-
$solver,
8-
ERR,
9-
EVENT,
10-
TYPE,
11-
dispatchEvent,
12-
} from '@utils'
13-
14-
import SR71 from 'utils/network/sr71'
3+
import { asyncSuit, buildLog, ERR, EVENT, TYPE, send } from '@utils'
154

165
import S from './schema'
176

18-
const sr71$ = new SR71({
19-
resv_event: [EVENT.PREVIEW_CLOSE],
20-
})
217
/* eslint-disable no-unused-vars */
228
const log = buildLog('L:communitiesBanner')
239
/* eslint-enable no-unused-vars */
2410

11+
const { SR71, asyncRes, asyncErr, $solver } = asyncSuit
12+
const sr71$ = new SR71({
13+
recieve: [EVENT.PREVIEW_CLOSE],
14+
})
15+
2516
let store = null
2617
let sub$ = null
2718

@@ -55,23 +46,23 @@ export const loadCategories = () =>
5546
export function onAdd(thread) {
5647
switch (thread) {
5748
case 'tags': {
58-
return dispatchEvent(EVENT.NAV_CREATE_TAG, {
49+
return send(EVENT.NAV_CREATE_TAG, {
5950
type: TYPE.PREVIEW_CREATE_TAG,
6051
})
6152
}
6253
case 'categories': {
63-
return dispatchEvent(EVENT.NAV_CREATE_CATEGORY, {
54+
return send(EVENT.NAV_CREATE_CATEGORY, {
6455
type: TYPE.PREVIEW_CREATE_CATEGORY,
6556
})
6657
}
6758
case 'threads': {
68-
return dispatchEvent(EVENT.NAV_CREATE_THREAD, {
59+
return send(EVENT.NAV_CREATE_THREAD, {
6960
type: TYPE.PREVIEW_CREATE_THREAD,
7061
})
7162
}
7263
default: {
7364
log('onAdd default: ', thread)
74-
return dispatchEvent(EVENT.NAV_CREATE_COMMUNITY, {
65+
return send(EVENT.NAV_CREATE_COMMUNITY, {
7566
type: TYPE.PREVIEW_CREATE_COMMUNITY,
7667
})
7768
}

0 commit comments

Comments
 (0)