-
Notifications
You must be signed in to change notification settings - Fork 20
/
firebase_watch.html
56 lines (52 loc) · 3.08 KB
/
firebase_watch.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<script type="text/x-red" data-template-name="firebase watch">
<!-- data-template-name identifies the node type this is for -->
<!-- Each of the following divs creates a field in the edit dialog. -->
<!-- Generally, there should be an input for each property of the node. -->
<!-- The for and id attributes identify the corresponding property -->
<!-- (with the 'node-input-' prefix). -->
<!-- The available icon classes are defined Twitter Bootstrap glyphicons -->
<div class="form-row">
<label for="node-input-firebaseurl"><i class="icon-tasks"></i> Firebase</label>
<input type="text" id="node-input-firebaseurl" placeholder="https://<your-firebase>.firebasio.com/<path>/<to>/<your>/<data>">
</div>
<br/>
<!-- By convention, most nodes have a 'name' property. The following div -->
<!-- provides the necessary field. Should always be the last option -->
<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="firebase watch">
<!-- data-help-name identifies the node type this help is for -->
<!-- This content appears in the Info sidebar when a node is selected -->
<!-- The first <p> is used as the pop-up tool tip when hovering over a -->
<!-- node in the palette. -->
<p>Generate messages for Firebase "value" events.</p>
<p>Supply a Firebase data url, and this node will watch for any changes at that data and generate a message.</p>
<p><em>(It will always generate at least one message at deploy time.)</em></p>
<p>Parameters:</br>
<strong>Firebase:</strong> The URL to your Firebase data. Can be the root of your whole Firebase, or you can add a RESTy path.</p>
<p>Outputs an object called <b>msg</b> containing <b>msg.href</b> and
<b>msg.payload</b>. msg.href is the url of the data. msg.payload is the data returned from Firebase. (The type of msg.payload depends on the data at that location)</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('firebase watch',{
category: 'firebase', // the palette category
defaults: { // defines the editable properties of the node
name: {value:""}, // along with default values.
firebaseurl: {value:"", required:true},
},
color: "#B24317",
inputs:0, // set the number of inputs - only 0 or 1
outputs:1, // set the number of outputs - 0 to n
// set the icon (held in icons dir below where you save the node)
icon: "firebase.png", // saved in icons/myicon.png
label: function() { // sets the default label contents
return this.name||"Watch";
},
labelStyle: function() { // sets the class to apply to the label
return this.name?"node_label_italic":"";
}
});
</script>