2022-01-24 02:23:08 +00:00
|
|
|
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
|
2022-03-01 09:40:02 +00:00
|
|
|
self:notifyUI(command, json_data);
|
2022-01-24 02:23:08 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Create ClientInstance (used by Lua)
|
|
|
|
ClientInstance = Client:new()
|