mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
22 lines
592 B
Lua
22 lines
592 B
Lua
local Client = class('Client')
|
|
|
|
freekill.client_callback = {}
|
|
|
|
function Client:initialize()
|
|
self.client = freekill.ClientInstance
|
|
self.notifyUI = function(self, command, json_data)
|
|
freekill.Backend:emitNotifyUI(command, json_data)
|
|
end
|
|
self.client.callback = function(_self, command, json_data)
|
|
local cb = freekill.client_callback[command]
|
|
if (type(cb) == "function") then
|
|
cb(json_data)
|
|
else
|
|
self:notifyUI(command, json_data);
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Create ClientInstance (used by Lua)
|
|
ClientInstance = Client:new()
|