Archived
upd
- added all non-jumping calls (cef <=> client, client <=> server) - added @ragempcommunity types (todo)
This commit is contained in:
@@ -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'])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user