FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cnodejs-reader/src/controller.coffee at master · cnodejs/cnodejs-reader · GitHub
cnodejs
/
cnodejs-reader
Public
Notifications
You must be signed in to change notification settings
Fork
8
Star
65
Code
Issues
1
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cnodejs-reader
/
src
/
controller.coffee
Copy path
More file actions
More file actions
Latest commit
History
History
History
109 lines (95 loc) · 3.08 KB
Breadcrumbs
cnodejs-reader
/
src
/
controller.coffee
Copy path
File metadata and controls
109 lines (95 loc) · 3.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
recorder
=
require
(
'
actions-recorder
'
)
Immutable
=
require
(
'
immutable
'
)
ajax
=
require
(
'
./ajax
'
)
actions
=
require
(
'
./actions
'
)
exports
.
start
=
->
store
=
recorder
.
getStore
()
page
=
store
.
getIn
([
'
device
'
,
'
page
'
])
actions
.
deviceLoading
'
start
'
ajax
.
topicGetList
page
+
1
, (
topicList
)
->
actions
.
topicGetList
topicList
actions
.
deviceLoaded
()
maybeToken
=
localStorage
.
getItem
(
'
cnodejs-reader-token
'
)
if
maybeToken
?
exports
.
userAccesstoken
maybeToken, (
loginname
)
->
exports
.
loopRequestMessages
maybeToken
exports
.
routerTopic
=
(
id
)
->
store
=
recorder
.
getStore
()
if
store
.
hasIn
([
'
topicDetails
'
, id])
actions
.
routerTopic
id
else
actions
.
deviceLoading
'
topic
'
ajax
.
topicGet
id, (
topic
)
->
actions
.
topicGet
topic
actions
.
routerTopic
id
actions
.
deviceLoaded
()
exports
.
routerUser
=
(
loginname
)
->
store
=
recorder
.
getStore
()
if
store
.
hasIn
([
'
users
'
, loginname])
actions
.
routerUser
loginname
else
actions
.
deviceLoading
'
user
'
maybeToken
=
localStorage
.
getItem
(
'
cnodejs-reader-token
'
)
if
maybeToken
!=
null
ajax
.
userGet
loginname, maybeToken, (
user
)
->
actions
.
userGet
user
actions
.
routerUser
loginname
actions
.
deviceLoaded
()
undefined
exports
.
userAccesstoken
=
(
token
)
->
ajax
.
userAccesstoken
token, (
loginname
)
->
actions
.
userLogin
loginname
localStorage
.
setItem
'
cnodejs-reader-token
'
, token
exports
.
loopRequestMessages
token
exports
.
routerPost
=
->
actions
.
routerPost
()
exports
.
topicCreate
=
(
data
)
->
token
=
localStorage
.
getItem
(
'
cnodejs-reader-token
'
)
actions
.
deviceLoaded
'
topic
'
ajax
.
topicCreate
data, token, (
id
)
->
ajax
.
topicGet
id, (
topic
)
->
actions
.
topicGet
topic
actions
.
routerTopic
id
actions
.
deviceLoaded
()
exports
.
replyCreate
=
(
data
)
->
token
=
localStorage
.
getItem
(
'
cnodejs-reader-token
'
)
ajax
.
replyCreate
data, token, (
id
)
->
ajax
.
topicGet
data
.
topic_id
, (
topic
)
->
actions
.
topicGet
topic
exports
.
topicMore
=
->
store
=
recorder
.
getStore
()
page
=
store
.
getIn
([
'
device
'
,
'
page
'
])
ajax
.
topicGetList
page
+
1
, (
topicList
)
->
actions
.
topicGetList
topicList
exports
.
topicRefresh
=
->
actions
.
routerHome
()
ajax
.
topicGetList
1
, (
topicList
)
->
actions
.
topicRefresh
topicList
exports
.
routerGo
=
(
info
)
->
switch
info
.
get
(
'
name
'
)
when
'
home
'
actions
.
routerHome
()
when
'
topic
'
exports
.
routerTopic
info
.
getIn
([
'
data
'
,
'
id
'
])
when
'
user
'
exports
.
routerUser
info
.
getIn
([
'
data
'
,
'
loginname
'
])
when
'
post
'
actions
.
routerPost
()
else
actions
.
routerHome
()
break
exports
.
loopRequestMessages
=
(
token
)
->
exports
.
messageGetList
token
setInterval
->
exports
.
messageGetList
token
,
20000
exports
.
messageGetList
=
(
token
)
->
store
=
recorder
.
getStore
()
currentMessages
=
store
.
get
(
'
messages
'
)
ajax
.
messageGetList
token, (
messages
)
->
if
!
Immutable
.
is
(
Immutable
.
fromJS
(messages), currentMessages)
actions
.
messageGetList
messages
exports
.
messageMarkAll
=
->
token
=
localStorage
.
getItem
(
'
cnodejs-reader-token
'
)
ajax
.
messageMarkAll
token,
->
actions
.
messageMarkAll
()
Back
|
FazBrowse Home
|
New Git URL