ts3 config get
This commit is contained in:
23
src/nodes/ts3-get/ts3-get.ts
Normal file
23
src/nodes/ts3-get/ts3-get.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { NodeInitializer } from "node-red";
|
||||
import { Ts3ConfigNode } from "../ts3-config/types";
|
||||
import { Ts3GetConfig, Ts3GetNode } from "./types";
|
||||
|
||||
const nodeInit: NodeInitializer = (RED): void => {
|
||||
function Ts3Get(
|
||||
this: Ts3GetNode,
|
||||
config: Ts3GetConfig
|
||||
): void {
|
||||
RED.nodes.createNode(this, config);
|
||||
this.warn(config.configid)
|
||||
this.ts3Config = RED.nodes.getNode(config.configid) as Ts3ConfigNode
|
||||
|
||||
this.on("input", (msg) => {
|
||||
msg.payload = this.ts3Config.credentials.username
|
||||
this.send(msg)
|
||||
})
|
||||
}
|
||||
|
||||
RED.nodes.registerType("ts3-get", Ts3Get);
|
||||
};
|
||||
|
||||
export = nodeInit;
|
||||
Reference in New Issue
Block a user