Last active
December 6, 2015 14:35
-
-
Save joeartsea/84ca4043060ddb1ee655 to your computer and use it in GitHub Desktop.
Node-REDのNode作成はじめの1歩 ref: http://qiita.com/joeartsea/items/11cef78442c3e7154a07
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ init: [Function], | |
start: [Function: start], | |
stop: [Function: stop], | |
nodes: | |
{ init: [Function: init], | |
load: [Function: load], | |
createNode: [Function: createNode], | |
getNode: [Function], | |
eachNode: [Function], | |
addFile: [Function: addFile], | |
addModule: [Function: addModule], | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(RED) { | |
function LowerCaseNode(config) { | |
RED.nodes.createNode(this,config); | |
console.log(this); // <- 追加 | |
var node = this; | |
this.on('input', function(msg) { | |
msg.payload = msg.payload.toLowerCase(); | |
node.send(msg); | |
}); | |
} | |
RED.nodes.registerType("lower-case",LowerCaseNode); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ id: '5c0d29a1.a3f2d8', | |
type: 'lower-case', | |
z: 'f56b199.f0a94e8', | |
_closeCallbacks: [], | |
wires: [ [ '17d78d74.e82873' ] ], | |
_wireCount: 1, | |
send: [Function], | |
_wire: '17d78d74.e82873' } | |
{ id: '112248a6.eeddb7', | |
type: 'lower-case', | |
z: 'f56b199.f0a94e8', | |
_closeCallbacks: [], | |
wires: [ [ 'b308844.f4cf778' ] ], | |
_wireCount: 1, | |
send: [Function], | |
_wire: 'b308844.f4cf778' } | |
{ id: 'f8fc3c36.0703c', | |
type: 'lower-case', | |
z: 'f56b199.f0a94e8', | |
_closeCallbacks: [], | |
wires: [ [ 'b2266937.4dd998' ] ], | |
_wireCount: 1, | |
send: [Function], | |
_wire: 'b2266937.4dd998' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(RED) { | |
function LowerCaseNode(config) { | |
RED.nodes.createNode(this,config); | |
var node = this; | |
this.on('input', function(msg) { | |
console.log(this); // <- 追加 | |
msg.payload = msg.payload.toLowerCase(); | |
node.send(msg); | |
}); | |
} | |
RED.nodes.registerType("lower-case",LowerCaseNode); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ id: '5c0d29a1.a3f2d8', | |
type: 'lower-case', | |
z: 'f56b199.f0a94e8', | |
_closeCallbacks: [], | |
wires: [ [ '17d78d74.e82873' ] ], | |
_wireCount: 1, | |
send: [Function], | |
_wire: '17d78d74.e82873', | |
_events: { input: [Function] } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"id":"1fce0738.e031f9","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":112,"y":65,"z":"f56b199.f0a94e8","wires":[["5c0d29a1.a3f2d8"]]}, | |
{"id":"5c0d29a1.a3f2d8","type":"lower-case","name":"","x":274,"y":71,"z":"f56b199.f0a94e8","wires":[["17d78d74.e82873"]]}, | |
{"id":"17d78d74.e82873","type":"debug","name":"","active":true,"console":"false","complete":"false","x":489,"y":74,"z":"f56b199.f0a94e8","wires":[]}, | |
{"id":"af2b7be1.50d488","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":119,"y":132,"z":"f56b199.f0a94e8","wires":[["112248a6.eeddb7"]]}, | |
{"id":"112248a6.eeddb7","type":"lower-case","name":"","x":281,"y":138,"z":"f56b199.f0a94e8","wires":[["b308844.f4cf778"]]}, | |
{"id":"b308844.f4cf778","type":"debug","name":"","active":true,"console":"false","complete":"false","x":496,"y":141,"z":"f56b199.f0a94e8","wires":[]}, | |
{"id":"f452540.f0badb","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":113,"y":203,"z":"f56b199.f0a94e8","wires":[["f8fc3c36.0703c"]]}, | |
{"id":"f8fc3c36.0703c","type":"lower-case","name":"","x":275,"y":209,"z":"f56b199.f0a94e8","wires":[["b2266937.4dd998"]]}, | |
{"id":"b2266937.4dd998","type":"debug","name":"","active":true,"console":"false","complete":"false","x":490,"y":212,"z":"f56b199.f0a94e8","wires":[]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
RED.nodes.registerType('lower-case',{ | |
category: 'function', | |
color: '#a6bbcf', | |
defaults: { | |
name: {value:""} | |
}, | |
inputs:1, | |
outputs:1, | |
icon: "file.png", | |
label: function() { | |
return this.name||"lower-case"; | |
} | |
}); | |
</script> | |
<script type="text/x-red" data-template-name="lower-case"> | |
<div class="form-row"> | |
<label for="node-input-name"><i class="icon-tag"></i> Name</label> | |
<input type="text" id="node-input-name" placeholder="Name"> | |
</div> | |
</script> | |
<script type="text/x-red" data-help-name="lower-case"> | |
<p>A simple node that converts the message payloads into all lower-case characters</p> | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(RED) { | |
function LowerCaseNode(config) { | |
console.log(RED); // <- 追加 | |
RED.nodes.createNode(this,config); | |
var node = this; | |
this.on('input', function(msg) { | |
msg.payload = msg.payload.toLowerCase(); | |
node.send(msg); | |
}); | |
} | |
RED.nodes.registerType("lower-case",LowerCaseNode); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment