mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
tidy up mysql some more
remove listeners on close and update status on partial deploy
This commit is contained in:
parent
738eada16b
commit
fe1a96d67d
@ -56,9 +56,9 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.connect = function() {
|
this.connect = function() {
|
||||||
if (!this.connected && !this.connecting) {
|
if (!this.connected && !this.connecting) { doConnect(); }
|
||||||
doConnect();
|
if (this.connected) { node.emit("state","connected"); }
|
||||||
}
|
else { node.emit("state","connecting"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
this.on('close', function (done) {
|
this.on('close', function (done) {
|
||||||
@ -127,6 +127,11 @@ module.exports = function(RED) {
|
|||||||
node.status({fill:"red",shape:"ring",text:"not yet connected"});
|
node.status({fill:"red",shape:"ring",text:"not yet connected"});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
node.on('close', function () {
|
||||||
|
node.mydbConfig.removeAllListeners();
|
||||||
|
node.status({});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.error("MySQL database not configured");
|
this.error("MySQL database not configured");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-mysql",
|
"name" : "node-red-node-mysql",
|
||||||
"version" : "0.0.12",
|
"version" : "0.0.13",
|
||||||
"description" : "A Node-RED node to read and write to a MySQL database",
|
"description" : "A Node-RED node to read and write to a MySQL database",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"mysql" : "^2.12.0"
|
"mysql" : "^2.12.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user