2024-10-30 20:17:26 +00:00
|
|
|
import { fw } from '@entityseven/rage-fw-browser'
|
2024-06-15 14:41:45 +00:00
|
|
|
import { useEffect, useState } from 'react'
|
2024-06-13 20:12:40 +00:00
|
|
|
|
2024-06-12 22:59:21 +00:00
|
|
|
function App() {
|
2024-10-30 20:17:26 +00:00
|
|
|
const [data, setData] = useState('initial')
|
2024-06-15 14:41:45 +00:00
|
|
|
|
2024-06-13 20:12:40 +00:00
|
|
|
useEffect(() => {
|
2024-10-30 20:17:26 +00:00
|
|
|
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'
|
2024-06-13 20:12:40 +00:00
|
|
|
})
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
return (
|
2024-09-30 18:40:58 +00:00
|
|
|
<div style={{ width: '100%', color: 'white', textAlign: 'center' }}>
|
2024-06-13 20:12:40 +00:00
|
|
|
<h1>Hello World!</h1>
|
2024-06-15 14:41:45 +00:00
|
|
|
<h2>{data}</h2>
|
2024-09-30 18:40:58 +00:00
|
|
|
</div>
|
2024-06-13 20:12:40 +00:00
|
|
|
)
|
2024-06-12 22:59:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default App
|