Function: localSubject()
Makaio Framework / bus-core / localSubject
Function: localSubject()
Section titled “Function: localSubject()”localSubject<
T>(schema):LocalSubjectSchema<T>
Defined in: ../../../packages/bus-core/src/utils/local-schema.ts:42
Create a local-only subject schema wrapper.
Local subjects are never sent to transports (SharedWorker, WebSocket, etc.). Use this for subjects whose payloads contain non-serializable data like React components or functions.
Type Parameters
Section titled “Type Parameters”T extends EventSchema | RequestSchema
Parameters
Section titled “Parameters”schema
Section titled “schema”T
The event or request schema to mark as local
Returns
Section titled “Returns”LocalSubjectSchema<T>
A LocalSubjectSchema wrapper
Example
Section titled “Example”import { localSubject } from '@makaio/bus-core';
const WidgetSchemas = { // Local event - contains React component, can't be serialized register: localSubject(widgetDefinitionSchema),
// Local request - response contains functions getRenderer: localSubject({ request: z.object({ widgetId: z.string() }), response: z.object({ render: z.function() }), }),};