23 lines
687 B
TypeScript
23 lines
687 B
TypeScript
import { events } from '@rage-fw/shared'
|
|
import { rpc } from './lib'
|
|
|
|
rpc.browser = mp.browsers.new('package://cef/index.html')
|
|
|
|
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'
|
|
})
|
|
|
|
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'
|
|
})
|