2022-01-24 02:23:08 +00:00
|
|
|
local Client = class('Client')
|
|
|
|
|
|
|
|
freekill.client_callback = {}
|
|
|
|
|
|
|
|
function Client:initialize()
|
|
|
|
self.client = freekill.ClientInstance
|
2022-03-02 12:56:37 +00:00
|
|
|
self.notifyUI = function(self, command, jsonData)
|
|
|
|
freekill.Backend:emitNotifyUI(command, jsonData)
|
2022-01-24 02:23:08 +00:00
|
|
|
end
|
2022-03-02 12:56:37 +00:00
|
|
|
self.client.callback = function(_self, command, jsonData)
|
2022-01-24 02:23:08 +00:00
|
|
|
local cb = freekill.client_callback[command]
|
|
|
|
if (type(cb) == "function") then
|
2022-03-02 12:56:37 +00:00
|
|
|
cb(jsonData)
|
2022-01-24 02:23:08 +00:00
|
|
|
else
|
2022-03-02 12:56:37 +00:00
|
|
|
self:notifyUI(command, jsonData);
|
2022-01-24 02:23:08 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Create ClientInstance (used by Lua)
|
|
|
|
ClientInstance = Client:new()
|