mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Expose reconciler hooks on servesession (#741)
This commit is contained in:
parent
8662d2227c
commit
4915477823
2 changed files with 7 additions and 11 deletions
|
|
@ -374,7 +374,7 @@ function App:startSession()
|
|||
end)
|
||||
end)
|
||||
|
||||
serveSession:onPatchApplied(function(patch, unapplied)
|
||||
serveSession:hookPostcommit(function(patch, _instanceMap, unapplied)
|
||||
local now = os.time()
|
||||
local old = self.state.patchData
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ function ServeSession.new(options)
|
|||
__instanceMap = instanceMap,
|
||||
__changeBatcher = changeBatcher,
|
||||
__statusChangedCallback = nil,
|
||||
__patchAppliedCallback = nil,
|
||||
__connections = connections,
|
||||
}
|
||||
|
||||
|
|
@ -129,8 +128,12 @@ function ServeSession:setConfirmCallback(callback)
|
|||
self.__userConfirmCallback = callback
|
||||
end
|
||||
|
||||
function ServeSession:onPatchApplied(callback)
|
||||
self.__patchAppliedCallback = callback
|
||||
function ServeSession:hookPrecommit(callback)
|
||||
return self.__reconciler:hookPrecommit(callback)
|
||||
end
|
||||
|
||||
function ServeSession:hookPostcommit(callback)
|
||||
return self.__reconciler:hookPostcommit(callback)
|
||||
end
|
||||
|
||||
function ServeSession:start()
|
||||
|
|
@ -291,9 +294,6 @@ function ServeSession:__initialSync(serverInfo)
|
|||
Log.warn("Could not apply all changes requested by the Rojo server:\n{}",
|
||||
PatchSet.humanSummary(self.__instanceMap, unappliedPatch))
|
||||
end
|
||||
if self.__patchAppliedCallback then
|
||||
pcall(self.__patchAppliedCallback, catchUpPatch, unappliedPatch)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
@ -318,10 +318,6 @@ function ServeSession:__mainSyncLoop()
|
|||
Log.warn("Could not apply all changes requested by the Rojo server:\n{}",
|
||||
PatchSet.humanSummary(self.__instanceMap, unappliedPatch))
|
||||
end
|
||||
|
||||
if self.__patchAppliedCallback then
|
||||
pcall(self.__patchAppliedCallback, message, unappliedPatch)
|
||||
end
|
||||
end
|
||||
end):await()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue