Modules

Docs / API / Modules / interfaces

Interfaces

Platform

@s2script/sdk/interfaces

publishInterface / consumer proxies for typed, versioned cross-plugin interfaces.

Import

import { PublishHandle } from "@s2script/sdk/interfaces";

Author-time types ship in the npm package; the engine injects the runtime at plugin load. Add @s2script/sdk to your plugin's dependencies.

API reference

Generated from the shipped type definitions.

interface
PublishHandle

Handle returned by ctx.publish(name, impl): lets the producer emit forwarded events to every plugin subscribed to this interface via its on(event, …).

emit(event: string, payload: unknown): void

Emit a forwarded event to all consumers subscribed via interface.on(event, …). The payload is structured-copied across the context boundary (JSON, EntityRef-aware — never a live reference).

import type { PublishHandle } from "@s2script/sdk/interfaces";
// plugins/zones/src/plugin.ts:30 — notify consumers a zone was created
iface.emit("created", { zone: z.name, min: z.min, max: z.max, tags: z.tags });
Back to modules All packages

s2script — Source 2 plugin framework

GitHub