upd deps
This commit is contained in:
parent
81639386e5
commit
fcb83f6636
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "rage-fw-example-cef",
|
"name": "rage-fw-example-browser",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": "Entity Seven Group",
|
"author": "Entity Seven Group",
|
||||||
"license": "CC BY-ND",
|
"license": "MIT",
|
||||||
"description": "CEF side of rage-fw example",
|
"description": "Browser side of rage-fw-example",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
@ -12,9 +12,9 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@entityseven/rage-fw-browser": "0.2.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0"
|
||||||
"rage-fw-cef": "latest"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^18.2.66",
|
"@types/react": "^18.2.66",
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
import { fw } from 'rage-fw-cef'
|
import { fw } from '@entityseven/rage-fw-browser'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [data, setData] = useState('')
|
const [data, setData] = useState('initial')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fw.event.register('customCefEvent', async ([test]) => {
|
fw.event.register('customBrowserEvent', async message => {
|
||||||
setData(p => p + ' ' + test)
|
setData(p => p + ' | ' + message)
|
||||||
return 'from cef'
|
|
||||||
|
const response = await fw.event.triggerServer('customServerEvent', [
|
||||||
|
'hello from browser',
|
||||||
|
])
|
||||||
|
setData(p => p + ' | ' + response)
|
||||||
|
|
||||||
|
return 'response from browser'
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
"name": "rage-fw-example-client",
|
"name": "rage-fw-example-client",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"author": "Entity Seven Group",
|
"author": "Entity Seven Group",
|
||||||
"license": "CC BY-ND",
|
"license": "MIT",
|
||||||
"description": "Client side of rage-fw example",
|
"description": "Client side of rage-fw-example",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "esbuild src/index.ts --bundle --platform=node --outfile=../../server/client_packages/index.js --format=esm"
|
"build": "esbuild src/index.ts --bundle --platform=node --outfile=../../server/client_packages/index.js --format=esm"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"rage-fw-client": "latest"
|
"@entityseven/rage-fw-client": "0.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { fw } from 'rage-fw-client'
|
import { fw } from '@entityseven/rage-fw-client'
|
||||||
|
|
||||||
fw.player.browser = mp.browsers.new('package://cef/index.html')
|
fw.player.browser = mp.browsers.new('package://cef/index.html')
|
||||||
|
|
||||||
fw.event.register('cefReady', async () => {
|
fw.event.register('customClientEvent', async msg => {
|
||||||
fw.system.log.info('cefReady')
|
fw.system.log.info(msg)
|
||||||
|
|
||||||
const responseCef = await fw.player.triggerBrowser('customCefEvent', [
|
const response = await fw.player.triggerBrowser('customBrowserEvent', [
|
||||||
'from client',
|
'hello from client',
|
||||||
])
|
])
|
||||||
fw.system.log.info(responseCef)
|
fw.system.log.info(response)
|
||||||
|
|
||||||
await fw.player.triggerServer('customServerEvent', ['from client'])
|
return 'response from client'
|
||||||
})
|
})
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
"name": "rage-fw-example-server",
|
"name": "rage-fw-example-server",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"author": "Entity Seven Group",
|
"author": "Entity Seven Group",
|
||||||
"license": "CC BY-ND",
|
"license": "MIT",
|
||||||
"description": "Server side of rage-fw example",
|
"description": "Server side of rage-fw-example",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "esbuild src/index.ts --bundle --platform=node --target=node10.4 --outfile=../../server/packages/server/index.js"
|
"build": "esbuild src/index.ts --bundle --platform=node --target=node10.4 --outfile=../../server/packages/server/index.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"rage-fw-server": "latest"
|
"@entityseven/rage-fw-server": "0.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,25 @@
|
|||||||
import { fw } from 'rage-fw-server'
|
import { fw } from '@entityseven/rage-fw-server'
|
||||||
|
|
||||||
fw.event.register('playerJoin', async ([player]) => {
|
fw.event.register('playerJoin', async player => {
|
||||||
fw.system.log.info(`Connected: ${player.socialClub}`)
|
fw.system.log.info('Connected:', player.socialClub)
|
||||||
})
|
|
||||||
|
|
||||||
fw.event.register('customServerEvent', async ([player, msg]) => {
|
const response = await fw.player.triggerClient(
|
||||||
fw.system.log.info(player.socialClub + ' ' + msg)
|
|
||||||
|
|
||||||
const resFromCef = await fw.player.triggerBrowser(
|
|
||||||
player,
|
player,
|
||||||
'customCefEvent',
|
'customClientEvent',
|
||||||
['from server'],
|
['hello from server'],
|
||||||
)
|
)
|
||||||
fw.system.log.info(player.socialClub + ' ' + resFromCef)
|
fw.system.log.info(response)
|
||||||
|
})
|
||||||
return 'from server'
|
|
||||||
|
fw.event.register('customServerEvent', async (player, msg) => {
|
||||||
|
fw.system.log.info(player.socialClub, msg)
|
||||||
|
|
||||||
|
const response = await fw.player.triggerBrowser(
|
||||||
|
player,
|
||||||
|
'customBrowserEvent',
|
||||||
|
['hello from server'],
|
||||||
|
)
|
||||||
|
fw.system.log.info(player.socialClub, response)
|
||||||
|
|
||||||
|
return 'response from server'
|
||||||
})
|
})
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
declare module 'rage-fw-shared-types' {
|
declare module '@entityseven/rage-fw-shared-types' {
|
||||||
export interface RageFW_ICustomClientEvent {}
|
export interface RageFW_ICustomClientEvent {
|
||||||
|
customClientEvent(greetings: string): string
|
||||||
|
}
|
||||||
|
|
||||||
export interface RageFW_ICustomServerEvent {
|
export interface RageFW_ICustomServerEvent {
|
||||||
customServerEvent(greetings: string): string
|
customServerEvent(greetings: string): string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RageFW_ICustomCefEvent {
|
export interface RageFW_ICustomBrowserEvent {
|
||||||
customCefEvent(greetings: string): string
|
customBrowserEvent(greetings: string): string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,15 +11,15 @@
|
|||||||
"build:all": "pnpm build:client && pnpm build:server && pnpm build:cef"
|
"build:all": "pnpm build:client && pnpm build:server && pnpm build:cef"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@entityseven/rage-fw-shared-types": "0.2.0",
|
||||||
"@ragempcommunity/types-client": "^2.1.8",
|
"@ragempcommunity/types-client": "^2.1.8",
|
||||||
"@ragempcommunity/types-server": "^2.1.8",
|
"@ragempcommunity/types-server": "^2.1.8",
|
||||||
"@ragempcommunity/types-cef": "^2.1.8",
|
"@ragempcommunity/types-cef": "^2.1.8",
|
||||||
"rage-fw-shared-types": "latest",
|
|
||||||
"esbuild": "^0.21.5",
|
"esbuild": "^0.21.5",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.4.5",
|
||||||
"prettier": "^3.3.2"
|
"prettier": "^3.3.2"
|
||||||
},
|
},
|
||||||
"author": "Entity Seven Group",
|
"author": "Entity Seven Group",
|
||||||
"license": "CC BY-ND",
|
"license": "MIT",
|
||||||
"version": "0.1.0"
|
"version": "0.1.0"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user