Transformer
Direct Subclass:
The base transformer class.
Static Method Summary
Static Public Methods | ||
public static |
combinedTransformer(transformers: Transformer[], direction: TransformDirection): function(node: Node): Promise<any> Returns a function that combines multiple transformer actions. |
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) Creates a new Transformer with the specified options. |
Member Summary
Public Members | ||
public |
direction: * |
Method Summary
Public Methods | ||
public |
compatTransform(direction: TransformDirection, node: Node, context: Object): * A transform wrapper that works with both async/await (atscm >= 1) and callback-based (atscm < 1)transformers. |
|
public |
readNodeFile(node: FileNode): boolean Determines if a node's value node should be read, e.G. The Variable.Bool file for a node defined in .Variable.Bool.Json. |
|
public |
async transformFromDB(node: BrowsedNode, context: Object) Must be overridden by all subclasses: Transforms the given node when using TransformDirection.FromDB. |
|
public |
async transformFromFilesystem(node: BrowsedNode, context: Object) Must be overridden by all subclasses: Transforms the given node when using TransformDirection.FromFilesystem. |
|
public |
withDirection(direction: TransformDirection): Transformer Returns the Transformer with the given direction. |
Static Public Methods
public static combinedTransformer(transformers: Transformer[], direction: TransformDirection): function(node: Node): Promise<any> source
Returns a function that combines multiple transformer actions.
Params:
Name | Type | Attribute | Description |
transformers | Transformer[] | An array of transformers. |
|
direction | TransformDirection | The direction to use. |
Public Constructors
public constructor(options: Object) source
Creates a new Transformer with the specified options.
Params:
Name | Type | Attribute | Description |
options | Object |
|
The options to use. |
options.direction | TransformDirection |
|
The direction to use. |
Throw:
Throws an error if the given direction is invalid. |
Test:
Public Members
public direction: * source
Public Methods
public compatTransform(direction: TransformDirection, node: Node, context: Object): * source
A transform wrapper that works with both async/await (atscm >= 1) and callback-based (atscm < 1)transformers.
Params:
Name | Type | Attribute | Description |
direction | TransformDirection | The direction to use. |
|
node | Node | The node to transform. |
|
context | Object | The browser context. |
Return:
* |
public readNodeFile(node: FileNode): boolean source
Determines if a node's value node should be read, e.G. The Variable.Bool file for a node defined in .Variable.Bool.Json.
Params:
Name | Type | Attribute | Description |
node | FileNode | The node to read or not. |
Return:
boolean | true if the node's value file should be read, undefined to let other transformers decide. |
public async transformFromDB(node: BrowsedNode, context: Object) source
Must be overridden by all subclasses: Transforms the given node when using TransformDirection.FromDB.
Params:
Name | Type | Attribute | Description |
node | BrowsedNode | The node to split. |
|
context | Object | The transform context. |
public async transformFromFilesystem(node: BrowsedNode, context: Object) source
Must be overridden by all subclasses: Transforms the given node when using TransformDirection.FromFilesystem.
Params:
Name | Type | Attribute | Description |
node | BrowsedNode | The node to transform. |
|
context | Object | The browser context. |
public withDirection(direction: TransformDirection): Transformer source
Returns the Transformer with the given direction.
Params:
Name | Type | Attribute | Description |
direction | TransformDirection | The direction to use. |
Throw:
Throws an error if the given direction is invalid. |