Skip to content

Event System API ​

Nexus Engine uses a highly optimized central engineEventBus to allow decoupled systems to communicate with each other.

Importing ​

typescript
import { engineEventBus, EventTypes } from '@neural-workspace/nexus-engine-core';

Emitting Events ​

typescript
engineEventBus.emit(EventTypes.PLAYER_MOVED, { x: 10, y: 0, z: 5 });

Subscribing to Events ​

typescript
useEffect(() => {
  const unsubscribe = engineEventBus.subscribe(EventTypes.PLAYER_MOVED, (payload) => {
    console.log("Player moved to:", payload);
  });

  return () => {
    unsubscribe();
  };
}, []);

Standard Event Types ​

  • SYSTEM_READY - Emitted when a system is fully initialized.
  • SCENE_LOADED - Emitted when all core nodes are parsed.
  • ERROR - Emitted on fatal runtime errors.