license + typos
parent
62c78ea30f
commit
3d45758eef
@ -87,7 +87,7 @@ rpc.unregister('playerDamage')
|
||||
```
|
||||
|
||||
## callClient
|
||||
Calls a client-side event from server or browser
|
||||
Calls a client-side event from server or browser (or client, but better use [call](#call))
|
||||
|
||||
From browser:
|
||||
```ts
|
||||
@ -103,7 +103,7 @@ rpc.callClient(player, 'updatePlayerData', ['argument']).then(response => {
|
||||
```
|
||||
|
||||
## callServer
|
||||
Calls a server-side event from browser or client
|
||||
Calls a server-side event from browser or client (or server, but better use [call](#call))
|
||||
```ts
|
||||
rpc.callServer('updatePlayerData', ['argument']).then(response => {
|
||||
console.log(`Received: ${response}`)
|
||||
@ -111,7 +111,7 @@ rpc.callServer('updatePlayerData', ['argument']).then(response => {
|
||||
```
|
||||
|
||||
## callBrowser
|
||||
Calls a server-side event from browser or client
|
||||
Calls a browser-side event from server or client (or browser, but better use [call](#call))
|
||||
|
||||
From client:
|
||||
```ts
|
||||
@ -119,7 +119,7 @@ rpc.callBrowser('updatePlayerData', ['argument']).then(response => {
|
||||
console.log(`Received: ${response}`)
|
||||
})
|
||||
```
|
||||
From client (requires player):
|
||||
From server (requires player):
|
||||
```ts
|
||||
rpc.callBrowser(player, 'updatePlayerData', ['argument']).then(response => {
|
||||
console.log(`Received: ${response}`)
|
||||
@ -140,3 +140,8 @@ These should be clear enough themselves, in other cases refer to here
|
||||
- ``UNKNOWN_ENVIRONMENT`` - throws in any environment that is not recognized as server/client/browser in Rage. Unlike ``rage-rpc`` this is not thrown in browser when launched without mp context IF you specify it in browser rpc options (see Options)
|
||||
- ``NO_BROWSER`` - throws on client if you failed to specify valid browser for it to refer to when calling browser
|
||||
- ``EVENT_RESPONSE_TIMEOUT`` - throws in Promise (rejects) when failed to receive a response data from called environment. You may not always want to receive it at all, for now it just works like this. Prefer adding ``catch`` on your events
|
||||
|
||||
# License
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Entity Seven Group
|
Loading…
Reference in New Issue
Block a user