mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 12:45:05 +00:00
Expose reconciler hooks on servesession (#741)
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user