2024-10-28 10:28:56 +00:00
|
|
|
import { events } from '@rage-fw/shared'
|
|
|
|
import { rpc } from './lib'
|
2024-06-13 20:12:40 +00:00
|
|
|
|
2024-10-28 10:28:56 +00:00
|
|
|
rpc.browser = mp.browsers.new('package://cef/index.html')
|
2024-06-15 14:41:45 +00:00
|
|
|
|
2024-10-28 10:28:56 +00:00
|
|
|
rpc.register(events.client.cefReady, async (args: string) => {
|
|
|
|
mp.console.logInfo(args)
|
|
|
|
const res = (await rpc.callServer(events.server.customServerEvent, [
|
|
|
|
'hello from client',
|
|
|
|
])) as string
|
|
|
|
mp.console.logInfo(res)
|
|
|
|
return 'response from client'
|
2024-10-03 17:59:41 +00:00
|
|
|
})
|
|
|
|
|
2024-10-28 10:28:56 +00:00
|
|
|
rpc.register(events.client.cefReady, async (args: string) => {
|
|
|
|
mp.console.logInfo(args)
|
|
|
|
const res = (await rpc.callBrowser(events.browser.customBrowserEvent, [
|
|
|
|
'hello from client',
|
|
|
|
])) as string
|
|
|
|
mp.console.logInfo(res)
|
|
|
|
return 'response from client'
|
2024-06-13 20:12:40 +00:00
|
|
|
})
|