blob: 49c90f8314f2c02c8330cd4623f136315348ee15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
local brave = require 'brave.brave'
local parser = require 'parser'
local fs = require 'bee.filesystem'
local furi = require 'file-uri'
local util = require 'utility'
local thread = require 'bee.thread'
brave.on('loadProto', function ()
local jsonrpc = require 'jsonrpc'
while true do
local proto, err = jsonrpc.decode(io.read)
--log.debug('loaded proto', proto.method)
if not proto then
brave.push('protoerror', err)
return
end
brave.push('proto', proto)
end
end)
brave.on('timer', function (time)
while true do
thread.sleep(time)
brave.push('wakeup')
end
end)
brave.on('loadFile', function (path)
return util.loadFile(path)
end)
|