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)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
serveSession:onPatchApplied(function(patch, unapplied)
|
serveSession:hookPostcommit(function(patch, _instanceMap, unapplied)
|
||||||
local now = os.time()
|
local now = os.time()
|
||||||
local old = self.state.patchData
|
local old = self.state.patchData
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ function ServeSession.new(options)
|
|||||||
__instanceMap = instanceMap,
|
__instanceMap = instanceMap,
|
||||||
__changeBatcher = changeBatcher,
|
__changeBatcher = changeBatcher,
|
||||||
__statusChangedCallback = nil,
|
__statusChangedCallback = nil,
|
||||||
__patchAppliedCallback = nil,
|
|
||||||
__connections = connections,
|
__connections = connections,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,8 +128,12 @@ function ServeSession:setConfirmCallback(callback)
|
|||||||
self.__userConfirmCallback = callback
|
self.__userConfirmCallback = callback
|
||||||
end
|
end
|
||||||
|
|
||||||
function ServeSession:onPatchApplied(callback)
|
function ServeSession:hookPrecommit(callback)
|
||||||
self.__patchAppliedCallback = callback
|
return self.__reconciler:hookPrecommit(callback)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ServeSession:hookPostcommit(callback)
|
||||||
|
return self.__reconciler:hookPostcommit(callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ServeSession:start()
|
function ServeSession:start()
|
||||||
@@ -291,9 +294,6 @@ function ServeSession:__initialSync(serverInfo)
|
|||||||
Log.warn("Could not apply all changes requested by the Rojo server:\n{}",
|
Log.warn("Could not apply all changes requested by the Rojo server:\n{}",
|
||||||
PatchSet.humanSummary(self.__instanceMap, unappliedPatch))
|
PatchSet.humanSummary(self.__instanceMap, unappliedPatch))
|
||||||
end
|
end
|
||||||
if self.__patchAppliedCallback then
|
|
||||||
pcall(self.__patchAppliedCallback, catchUpPatch, unappliedPatch)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -318,10 +318,6 @@ function ServeSession:__mainSyncLoop()
|
|||||||
Log.warn("Could not apply all changes requested by the Rojo server:\n{}",
|
Log.warn("Could not apply all changes requested by the Rojo server:\n{}",
|
||||||
PatchSet.humanSummary(self.__instanceMap, unappliedPatch))
|
PatchSet.humanSummary(self.__instanceMap, unappliedPatch))
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.__patchAppliedCallback then
|
|
||||||
pcall(self.__patchAppliedCallback, message, unappliedPatch)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end):await()
|
end):await()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user