2024-10-03 17:59:41 +00:00
|
|
|
import { rpc, client } from 'rpc'
|
2024-06-13 20:12:40 +00:00
|
|
|
|
2024-10-03 17:59:41 +00:00
|
|
|
client.browser = mp.browsers.new('package://cef/index.html')
|
2024-06-15 14:41:45 +00:00
|
|
|
|
2024-10-03 17:59:41 +00:00
|
|
|
rpc.register('cefReady', async () => {
|
|
|
|
mp.console.logInfo('cef to client')
|
2024-06-13 20:12:40 +00:00
|
|
|
|
2024-10-03 17:59:41 +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
|
|
|
|
2024-10-03 17:59:41 +00:00
|
|
|
rpc.callBrowser('customCefEvent', ['client to cef'])
|
2024-06-13 20:12:40 +00:00
|
|
|
})
|