rage-framework-example/apps/client/src/index.ts

16 lines
399 B
TypeScript
Raw Normal View History

import { rpc, client } from 'rpc'
2024-06-13 20:12:40 +00:00
client.browser = mp.browsers.new('package://cef/index.html')
2024-06-15 14:41:45 +00:00
rpc.register('cefReady', async () => {
mp.console.logInfo('cef to client')
2024-06-13 20:12:40 +00:00
rpc.callServer('customServerEvent', ['client to server'])
})
rpc.register('customClientEvent', async data => {
mp.console.logInfo(JSON.stringify(data))
2024-06-13 20:12:40 +00:00
rpc.callBrowser('customCefEvent', ['client to cef'])
2024-06-13 20:12:40 +00:00
})