subscribe and unsubscribe
This commit is contained in:
parent
03e653acd3
commit
bf1ba794bd
@ -222,6 +222,7 @@ render-navbar = ->
|
|||||||
h \div.navbar-start [
|
h \div.navbar-start [
|
||||||
h \a.navbar-item.is-size-2 {
|
h \a.navbar-item.is-size-2 {
|
||||||
onclick: ->
|
onclick: ->
|
||||||
|
model.todod-ws.unsubscribe model.viewed-project.id
|
||||||
model.viewed-project := void
|
model.viewed-project := void
|
||||||
model.current-view := "project-list"
|
model.current-view := "project-list"
|
||||||
} [ "⌂" ]
|
} [ "⌂" ]
|
||||||
@ -243,6 +244,7 @@ render-project-list = ->
|
|||||||
onclick: ->
|
onclick: ->
|
||||||
model.current-view := "project"
|
model.current-view := "project"
|
||||||
model.viewed-project := project.id
|
model.viewed-project := project.id
|
||||||
|
model.todod-ws.subscribe project.id
|
||||||
model.todod-ws.get-list project.id
|
model.todod-ws.get-list project.id
|
||||||
model.todod-ws.get-tasks project.id
|
model.todod-ws.get-tasks project.id
|
||||||
} [
|
} [
|
||||||
|
@ -19,6 +19,8 @@ module.exports = {
|
|||||||
"add-task": 7
|
"add-task": 7
|
||||||
"remove-task": 8
|
"remove-task": 8
|
||||||
"edit-task": 9
|
"edit-task": 9
|
||||||
|
"subscribe": 10
|
||||||
|
"unsubscribe": 11
|
||||||
}
|
}
|
||||||
|
|
||||||
response-types = {
|
response-types = {
|
||||||
@ -33,6 +35,8 @@ module.exports = {
|
|||||||
"task-created": 8
|
"task-created": 8
|
||||||
"task-removed": 9
|
"task-removed": 9
|
||||||
"task-updated": 10
|
"task-updated": 10
|
||||||
|
"subscribed": 11
|
||||||
|
"unsubscribed": 12
|
||||||
}
|
}
|
||||||
|
|
||||||
# users can record functions to run on events
|
# users can record functions to run on events
|
||||||
@ -162,5 +166,17 @@ module.exports = {
|
|||||||
|
|
||||||
self.send request-types[\edit-task], JSON.stringify payload
|
self.send request-types[\edit-task], JSON.stringify payload
|
||||||
|
|
||||||
|
self.subscribe = (list-id) ->
|
||||||
|
self.send request-types[\subscribe], JSON.stringify {
|
||||||
|
token: self.token
|
||||||
|
list: list-id
|
||||||
|
}
|
||||||
|
|
||||||
|
self.unsubscribe = (list-id) ->
|
||||||
|
self.send request-types[\unsubscribe], JSON.stringify {
|
||||||
|
token: self.token
|
||||||
|
list: list-id
|
||||||
|
}
|
||||||
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user