- added all non-jumping calls (cef <=> client, client <=> server)
- added @ragempcommunity types (todo)
This commit is contained in:
2024-10-03 18:59:41 +01:00
parent 092693acb5
commit f8dd4d9fce
14 changed files with 162 additions and 103 deletions
+10 -9
View File
@@ -1,14 +1,15 @@
import { fw } from 'rage-fw-client'
import { rpc, client } from 'rpc'
fw.player.browser = mp.browsers.new('package://cef/index.html')
client.browser = mp.browsers.new('package://cef/index.html')
fw.event.register('cefReady', async () => {
fw.system.log.info('cefReady')
rpc.register('cefReady', async () => {
mp.console.logInfo('cef to client')
const responseCef = await fw.player.triggerBrowser('customCefEvent', [
'from client',
])
fw.system.log.info(responseCef)
rpc.callServer('customServerEvent', ['client to server'])
})
await fw.player.triggerServer('customServerEvent', ['from client'])
rpc.register('customClientEvent', async data => {
mp.console.logInfo(JSON.stringify(data))
rpc.callBrowser('customCefEvent', ['client to cef'])
})