mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-06 22:27:53 -04:00
Added beforeEmit and afterEmit World callbacks
This commit is contained in:
parent
64513ca16b
commit
9e0eeddea9
1 changed files with 9 additions and 1 deletions
|
@ -318,7 +318,11 @@ function World:emit(functionName, ...)
|
||||||
|
|
||||||
self.__emitSDepth = self.__emitSDepth + 1
|
self.__emitSDepth = self.__emitSDepth + 1
|
||||||
|
|
||||||
local listeners = self.__events[functionName]
|
local listeners = self.__events[functionName]
|
||||||
|
|
||||||
|
if Type.isCallable(self.beforeEmit) then
|
||||||
|
self:beforeEmit(functionName, listeners, ...)
|
||||||
|
end
|
||||||
|
|
||||||
if listeners then
|
if listeners then
|
||||||
for i = 1, #listeners do
|
for i = 1, #listeners do
|
||||||
|
@ -334,6 +338,10 @@ function World:emit(functionName, ...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Type.isCallable(self.afterEmit) then
|
||||||
|
self:afterEmit(functionName, listeners, ...)
|
||||||
|
end
|
||||||
|
|
||||||
self.__emitSDepth = self.__emitSDepth - 1
|
self.__emitSDepth = self.__emitSDepth - 1
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue