Skip to content

API Function defineWorldService

github-actions[bot] edited this page Nov 28, 2026 · 7 revisions

Function: defineWorldService()

function defineWorldService<T>(id): WorldServiceKey<T>;

Defined in: src/engine/core/worldServices.ts:364

A typed key for the World service id, for code that uses another plugin's service when it's there:

const Physics3D = defineWorldService<Physics3DService>("myco.physics3d");
const physics = worldService(Physics3D); // null when the current World isn't running it

Type Parameters

T

T

Parameters

id

string

Returns

WorldServiceKey<T>

Clone this wiki locally