Merge remote-tracking branch 'origin/master'

# Conflicts:
#	apps/client/package.json
#	apps/client/src/index.ts
#	apps/server/package.json
#	apps/server/src/index.ts
This commit is contained in:
Oleksandr Honcharov 2025-03-28 02:25:06 +02:00
commit 44983b4aea
17 changed files with 46 additions and 38 deletions

View File

@ -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",

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

28
apps/browser/src/App.tsx Normal file
View File

@ -0,0 +1,28 @@
import { fw } from '@entityseven/rage-fw-browser'
import { useEffect, useState } from 'react'
function App() {
const [data, setData] = useState('initial')
useEffect(() => {
fw.event.register('customBrowserEvent', async message => {
setData(p => p + ' | ' + message)
const response = await fw.event.triggerServer('customServerEvent', [
'hello from browser',
])
setData(p => p + ' | ' + response)
return 'response from browser'
})
}, [])
return (
<div style={{ width: '100%', color: 'white', textAlign: 'center' }}>
<h1>Hello World!</h1>
<h2>{data}</h2>
</div>
)
}
export default App

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,22 +0,0 @@
import { fw } from 'rage-fw-cef'
import { useEffect, useState } from 'react'
function App() {
const [data, setData] = useState('')
useEffect(() => {
fw.event.register('customCefEvent', ([test]) => {
setData(test)
return 'response from cef'
})
}, [])
return (
<>
<h1>Hello World!</h1>
<h2>{data}</h2>
</>
)
}
export default App

View File

@ -1,13 +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): Promise<string> 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
} }
} }

View File

@ -1,9 +1,7 @@
{ {
"name": "framework-example", "name": "framework-example",
"version": "0.1.0",
"author": "Entity Seven Group",
"license": "CC BY-ND",
"description": "This project is example of RAGE FW usage.", "description": "This project is example of RAGE FW usage.",
"workspaces": ["apps/*"],
"scripts": { "scripts": {
"server:update": "cd server && rage-win64.exe", "server:update": "cd server && rage-win64.exe",
"build:client": "cd apps/client && pnpm build", "build:client": "cd apps/client && pnpm build",
@ -12,12 +10,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",
"license": "MIT",
"version": "0.1.0"
} }

View File

@ -1,5 +1,5 @@
packages: packages:
- "apps/cef" - "apps/browser"
- "apps/client" - "apps/client"
- "apps/server" - "apps/server"
- "apps/shared" - "apps/shared"

View File

@ -1,9 +1,10 @@
{ {
"maxplayers" : 100, "maxplayers" : 100,
"name" : "RAGE FW Server powered by Entity Seven Group", "name" : "RageFW Example Server. Powered by Entity Seven Group",
"gamemode" : "freeroam", "gamemode" : "freeroam",
"stream-distance" : 300.0, "stream-distance" : 300.0,
"announce" : false, "announce" : false,
"csharp" : "disabled", "csharp" : "disabled",
"allow-cef-debugging": true,
"port": 22005 "port": 22005
} }