mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Refactor Session and ApiContext to allow cancelation
This commit is contained in:
parent
f21f01be1a
commit
30ce927621
3 changed files with 83 additions and 75 deletions
|
|
@ -95,8 +95,9 @@ function App:render()
|
|||
local success, session = Session.new({
|
||||
address = address,
|
||||
port = port,
|
||||
onError = function()
|
||||
Logging.trace("Session terminated")
|
||||
onError = function(message)
|
||||
Logging.warn("%s", tostring(message))
|
||||
Logging.trace("Session terminated due to error")
|
||||
self.currentSession = nil
|
||||
|
||||
self:setState({
|
||||
|
|
@ -145,12 +146,13 @@ function App:didMount()
|
|||
if self.state.sessionStatus == SessionStatus.Connected then
|
||||
Logging.trace("Disconnecting session")
|
||||
|
||||
self.currentSession:disconnect()
|
||||
self.currentSession = nil
|
||||
self:setState({
|
||||
sessionStatus = SessionStatus.Disconnected,
|
||||
})
|
||||
|
||||
error("TODO: Actually disconnect old session")
|
||||
Logging.trace("Session terminated by user")
|
||||
elseif self.state.sessionStatus == SessionStatus.Disconnected then
|
||||
Logging.trace("Starting session configuration")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue