registerEnvironment

Registers an environment's compile spec, so the library builder, the refiners and the semantic pass know it.

@internote/canvas-sdkFunction
On this page
import { registerEnvironment } from '@internote/canvas-sdk';

Re-registering the same name is an error unless it is the identical spec object: a module imported twice registers once, and a silent redefinition is refused. EnvironmentRegistry.register calls this for a definition; call it directly from a React-free module when a server compiles documents without loading the surface. It throws an EnvironmentRegistrationError when the spec is invalid or conflicts with one already registered.

#Signature

(spec: EnvironmentSpec): void

#Parameters

spec
The environment's compile spec.

#Example

import { registerEnvironment } from '@internote/canvas-sdk';
import { greetingSpec } from './greeting-spec';

registerEnvironment(greetingSpec);

Declared in packages/canvas-sdk/src/environment/registry.ts:185.

Last updated