# Custom node without input

**URL:** <https://discourse.nodered.org/t/custom-node-without-input/10749>\
**Category:** General\
**Created:** [2 May 2019 12:40 UTC](https://discourse.nodered.org/t/custom-node-without-input/10749 "2019-05-02T12:40:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Louise](https://avatars.discourse-cdn.com/v4/letter/l/ed8c4c/32.png) [@Louise](https://discourse.nodered.org/u/Louise)\
**Post date:** [2 May 2019 12:40 UTC](https://discourse.nodered.org/t/custom-node-without-input/10749/1 "2019-05-02T12:40:17Z")

</div>

Hello,

I've been experimenting with custom nodes and I try to create a node that will output once two messages and that has no input. In the html file I've already specified that I have no input and two outputs. My problem is in the .js file. In all of the examples that I've seen the .js file is written like this:

```auto
module.exports = function(RED) {
    function MyFunction(config) {
        RED.nodes.createNode(this,config);
        // some stuff to deal with the defaults of the html file
        var node = this;
        node.on('input', function(msg)) {
            // my function
            node.send(msg);
        }
    }
    RED.nodes.registerType("my-function",MyFunction);
}

```

The problem is that I do not have an input to trigger node.on, so how do I do this part?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 May 2019 12:44 UTC](https://discourse.nodered.org/t/custom-node-without-input/10749/2 "2019-05-02T12:44:00Z")

</div>

The sourcecode for all the Input nodes is available on the github site.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [2 May 2019 12:46 UTC](https://discourse.nodered.org/t/custom-node-without-input/10749/3 "2019-05-02T12:46:43Z")

</div>

```auto
module.exports = function(RED) {
    function MyFunction(config) {
        RED.nodes.createNode(this,config);

           msg = {"payload":"bla"}
           node.send(msg);
           node.send(msg);
    }
    RED.nodes.registerType("my-function",MyFunction);
}

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 May 2019 12:47 UTC](https://discourse.nodered.org/t/custom-node-without-input/10749/4 "2019-05-02T12:47:33Z")

</div>

If you have no input, what are you going to trigger it with.? Whatever it is - whenever you receive that - is when you then call node.send.

---

<div class="post-metadata">

**Author:** ![Louise](https://avatars.discourse-cdn.com/v4/letter/l/ed8c4c/32.png) [@Louise](https://discourse.nodered.org/u/Louise)\
**Post date:** [2 May 2019 13:36 UTC](https://discourse.nodered.org/t/custom-node-without-input/10749/5 "2019-05-02T13:36:53Z")

</div>

It should trigger itself after deploy (maybe with a short delay).

---

<div class="post-metadata">

**Author:** ![Louise](https://avatars.discourse-cdn.com/v4/letter/l/ed8c4c/32.png) [@Louise](https://discourse.nodered.org/u/Louise)\
**Post date:** [2 May 2019 13:37 UTC](https://discourse.nodered.org/t/custom-node-without-input/10749/6 "2019-05-02T13:37:24Z")

</div>

Thank you! I'll try that.
