Namespaces module
📖 Description
The Namespaces
class is used to load runner block bundles.
▶️ Functions
🔧 get
Retrieves the namespace for the specified identifier (or the default namespace if the identifier is omitted).
Signature
get(identifier?: string): INamespace
Parameters
Name | Type | Optional | Description |
---|---|---|---|
identifier | string | No | Specifies the identifier of the namespace to retrieve. |
Return value
Returns the INamespace
object that holds the blocks for the namespace.
🔧 isAvailable
Retrieves if a namespace exists for the specified identifier.
Signature
isAvailable(identifier?: string): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
identifier | string | No | Specifies the identifier of the namespace to check. |
Return value
Returns true
if the namespace exists.
🔧 loadUMD
Loads a block bundle using UMD code.
Loading UMD code from a string is unsafe! Only use when the source of the UMD code is trusted. When you are using a Content Security Policy (CSP) configuration, make sure script-src 'unsafe-eval'
is allowed.
Signature
loadUMD(umd: string): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
umd | string | No | Specifies the UMD code to load. |
Return value
Returns true
if the UMD code was successfully loaded.
🔧 loadURL
Loads a block bundle from an URL.
The UMD bundle is loaded using trusted-types with a policy named tripetto#runner
. Please read the Content Security Policy guide for more information.
Signature
loadURL(url: string, done?: (succeeded: boolean) => void): void
Parameters
Name | Type | Optional | Description |
---|---|---|---|
url | string | No | Specifies the URL of the UMD block bundle to load. |
done | (succeeded: boolean) => void | Yes | Callback function that is invoked when the loading is completed. |
🔧 mount
Mounts (activates) a namespace context. All blocks that self-register when this namespace is mounted will become part of the namespace.
You can also use the shorthand mountNamespace
function.
Signature
mount(identifier?: string): void
Parameters
Name | Type | Optional | Description |
---|---|---|---|
identifier | string | No | Specifies the identifier of the namespace to mount. |
🔧 unload
Unloads the specified namespace.
Signature
unload(identifier?: string): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
identifier | string | No | Specifies the identifier of the namespace to unload. |
Return value
Returns true
when the namespace is unloaded.
🔧 unmount
Unmounts (deactivates) the active namespace context.
You can also use the shorthand unmountNamespace
function.
Signature
unmount(): void