mountNamespace
Mounts (activates) a namespace context. All blocks that self-register (using the @tripetto
decorator) when this namespace is mounted will become part of the namespace.
tip
For the runner part of a block, the namespace can also be defined using a property in the @tripetto
decorator. This is the preferred approach and prevents the use of the mountNamespace
function on the runner side of things.
Signature
mountNamespace(identifier: string): void
Parameters
Name | Type | Optional | Description |
---|---|---|---|
identifier | string | No | Specifies the identifier of the namespace to activate. |
info
Shorthand for Namespaces.mount
.
Example
import { mountNamespace, unmountNamespace } from "@tripetto/runner";
import { namespace as autoscrollNamespace } from "@tripetto/runner-autoscroll";
import { namespace as classicNamespace } from "@tripetto/runner-classic";
mountNamespace(autoscrollNamespace);
// Load a generic runner part of a block in the Autoscroll runner namespace
import "./example-block.ts";
mountNamespace(classicNamespace);
// Also load it in the Classic runner namespace
import "./example-block.ts";
unmountNamespace();