Interface: IPlatformDriver<TPlayer>
Abstraction over the underlying platform’s event and WebView APIs. Implement this interface to integrate Aurora with a specific multiplayer platform.
Type Parameters
TPlayer
TPlayer
= unknown
The native player type provided by the platform (e.g., server or client player object).
Methods
createWebview()?
optional
createWebview(id
,url
,focused
,hidden
):IWebView
Creates a new WebView instance on the client side.
Parameters
id
Unique identifier for this WebView instance.
string
| number
url
string
The URL to load in the WebView.
focused
boolean
hidden
boolean
Returns
An IWebView wrapper around the platform-specific WebView.
destroyWebview()?
optional
destroyWebview(id
):void
Destroys an existing WebView instance.
Parameters
id
The unique identifier of the WebView to destroy.
string
| number
Returns
void
emit()
emit(
eventName
, ...args
):void
Emits a general event to all listeners (server or client).
Parameters
eventName
string
The name of the event to emit.
args
...unknown
[]
Arguments to pass along to event listeners.
Returns
void
emitClient()?
optional
emitClient(player
,eventName
, ...args
):void
Emits a client-specific event to a single player.
Parameters
player
TPlayer
The native player object to target.
eventName
string
The name of the client event to emit.
args
...unknown
[]
Arguments to pass along to the client listener.
Returns
void
emitServer()?
optional
emitServer(eventName
, ...args
):void
Emits a server-specific event.
Parameters
eventName
string
The name of the server event to emit.
args
...unknown
[]
Arguments to pass along to server-side listeners.
Returns
void
on()
on(
eventName
,listener
):void
Subscribes to a general platform event (server-side or client-side).
Parameters
eventName
string
The name of the event (e.g., 'playerConnect', 'resourceStart').
listener
(...args
) => void
Callback invoked when the event fires; receives the raw event arguments.
Returns
void
onClient()?
optional
onClient(eventName
,listener
):void
Subscribes to a client-originated event.
Parameters
eventName
string
The name of the client event.
listener
(player
, ...args
) => void
Callback invoked with the player instance and event arguments.
Returns
void
onServer()?
optional
onServer(eventName
,listener
):void
Subscribes to a server-originated event.
Parameters
eventName
string
The name of the server event.
listener
(player
, ...args
) => void
Callback invoked with the player instance and event arguments.
Returns
void