EnvironmentRegistry

The one place environments are registered, for first-party and plugin environments alike.

@internote/canvas-sdkConstant
On this page
import { EnvironmentRegistry } from '@internote/canvas-sdk';

Registering a definition serves both sides at once: the definition becomes resolvable for hosts, and its compile-side slice goes to the registry the library builder, the refiners and the semantic pass read. Its methods:

  • register(def) registers a definition, and is a no-op for the same object registered again.
  • unregister(name) removes one, which a test host does between cases.
  • resolve(name) returns the definition under a bare name, or undefined.
  • has(name) says whether a name is registered.
  • registeredNames() lists the names in registration order.

A plugin's definition arrives here through loadEnvironmentFromManifest.

#Signature

EnvironmentRegistryClass

#Example

import { EnvironmentRegistry } from '@internote/canvas-sdk';
import { greetingEnvironment } from './greeting';

EnvironmentRegistry.register(greetingEnvironment);

Declared in packages/canvas-sdk/src/environment/EnvironmentRegistry.ts:112.

Last updated