# Dumb question about editing a node

**URL:** <https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434>\
**Category:** General\
**Created:** [18 October 2020 04:20 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434 "2020-10-18T04:20:46Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 October 2020 23:02 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/61 "2020-10-30T23:02:39Z")

</div>

This might be a topic for a new thread but...

- `this.on('close'` is server side (node removed / used for server side clean up)
- oneditdelete is client side (for client side tasks when a node is deleted from the editor)

I've written a few nodes and so far had no need to use `oneditdelete` (yet) but I do use `this.on('close'` for various server side clean up)

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [30 October 2020 23:07 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/62 "2020-10-30T23:07:58Z")

</div>

Well, my problem seems to be that my location node gives the server node a callback to use when the server detects a status change, but when that location node is deleted, I need to remove that callback stored in the server node because I'm still seeing output from it in the log.

I don't understand how the deleted location node is able to print to the log, but in either case, the callback does need to get removed from the server node...

So does oneditdelete trigger if a node is deleted via selection & delete key (i.e. without opening the edit dialog)?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 October 2020 23:12 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/63 "2020-10-30T23:12:30Z")

</div>

> [@hepcat72](#):
>
> So does oneditdelete trigger if a node is deleted via selection & delete key (i.e. without opening the edit dialog)?

add `debugger` key word into your node, restart node-red, open the browser & devtools, give it a go. Y

As i said earlier, I've not used it but i suspect it will fire when deleted from the editor (before deploy - so in other words, still active in the runtime).

If you want to remove callbacks at the server side, I would suggest you need to use `this.on('close'` and its parameters to determine if there is a clean up (at server side) to do.

[reference](https://nodered.org/docs/creating-nodes/node-js#closing-the-node)

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [30 October 2020 23:19 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/64 "2020-10-30T23:19:14Z")

</div>

Huh. Yeah, that doc is where I learned about the `this.on('close'`. I'll reread it a few times more. I'm not entirely sure where it goes in the server node's code or how the location node deletion triggers it if it's in the server code. Thanks for the help.

---

<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:** [30 October 2020 23:22 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/65 "2020-10-30T23:22:15Z")

</div>

It gets called whenever you hit the deploy button (and that node is affected by the deploy) or ctrl-c - ie whenever that node is stopped - at which point it should tidy up any "old" connections ready to be started again.

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [31 October 2020 00:37 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/66 "2020-10-31T00:37:13Z")

</div>

I got it working. I was a little surprised that when I searched for `this.on('close'...` in node-red-nodes, I didn't find examples of it being called from inside a constructor. In fact, the examples I saw didn't even have class definitions, so it seemed a little magical to me (since I don't know javascript) and I felt a bit disoriented, but once I decided I needed to put it in the constructor, it made a lot more sense.

I pushed an update to that repo (if anyone is following this).

---

<div class="post-metadata">

**Author:** ![Prog72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/prog72/32/31578_2.png) [@Prog72](https://discourse.nodered.org/u/Prog72)\
**Post date:** [8 November 2020 23:14 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/67 "2020-11-08T23:14:02Z")

</div>

> [@hepcat72](#):
>
> if anyone is following this

I'm definitely following this, not that I understand most of it. I do however use Life360 currently with IFTTT and would love to get it working in Node-RED ahead of IFTTT support ending.

I'm unsure of the etiquette but if I can help in any small way with testing then please let me know.

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [9 November 2020 16:00 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/68 "2020-11-09T16:00:55Z")

</div>

Thanks @Prog72. I was able to implement a debug/test mode that allowed me to simulate departures on startup. (The code base was already capable of triggering artificial arrivals on startup [because all previous locations are null on the first check]. I just added a way to set prior locations when `debugLeave` is set to true [though setting the starting conditions is not straight-forward - I tried commenting it to explain].) My testing was not exhaustive, but I do think I confirmed it's problem-free this past weekend. There could exist edge cases, including in the GUI.

I also re-packaged my fork to be independent (renaming it [`node-red-contrib-life360`](https://github.com/hepcat72/node-red-contrib-life360)), since I haven't heard back from the original developer except for a single comment 25 days ago saying he was too busy. I'd never published an npm before, and I ran into an issue upon `npm publish`:

```auto
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/node-red-contrib-life360 - Package name triggered spam detection; if you believe this is in error, please contact support@npmjs.com
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-11-09T15_54_51_024Z-debug.log

```

I emailed `support@npmjs.com`. I don't know how long they typically take to reply, but I hope within a week.

I don't know how to install it for node red without using it's palette tool, but feel free to do a local install of the package and/or review the code in the [PR](https://github.com/andreyoshev/node-red-contrib-life/pull/4).

---

<div class="post-metadata">

**Author:** ![Prog72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/prog72/32/31578_2.png) [@Prog72](https://discourse.nodered.org/u/Prog72)\
**Post date:** [9 November 2020 20:59 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/69 "2020-11-09T20:59:40Z")

</div>

> [@hepcat72](#):
>
> feel free to do a local install of the package

Thanks, I've installed it and everything seems to be working flawlessly. I'll obviously raise an issue if I spot any problems but so far it's looking good. 👍

Thanks for your hard work getting this node functional before the IFTTT support ends. It's very much appreciated.

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [9 November 2020 21:16 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/70 "2020-11-09T21:16:43Z")

</div>

Yay!

Thanks for reporting back.

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [10 November 2020 13:37 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/71 "2020-11-10T13:37:44Z")

</div>

I was googling around some more this morning trying to get the package to publish on NPM and I saw in a stack post which suggested I prepend the name with my @username/, which seems to have worked. It's published now at:

> **[@hepcat72/node-red-contrib-life360](https://www.npmjs.com/package/@hepcat72/node-red-contrib-life360)**
>
> Life360 nodes for node-red

When I look in node-red however, I see "Type already registered" in the palette install tab:

 ![nrcl360](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/6/36aef3653053ee9a00d3cfb771f771269df864d8.png)

Is that because I've been editing the code inside node red? Or is it because I need to edit something to make it more distinct from node-red-contib-life? (I haven't installed my version of the package in my node red instance yet and the package info from the install should still match the original node-red-contrib-life.)

---

<div class="post-metadata">

**Author:** ![Prog72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/prog72/32/31578_2.png) [@Prog72](https://discourse.nodered.org/u/Prog72)\
**Post date:** [10 November 2020 13:41 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/72 "2020-11-10T13:41:13Z")

</div>

I had that issue when I still had node-red-contrib-life installed. I removed it but I think I also may have had to re-install your node-red-contrib-life360 to get rid of the error.

It seems to me that Node-RED may be getting them confused somehow so you may well need to change something in that regard.

---

<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:** [10 November 2020 13:54 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/73 "2020-11-10T13:54:12Z")

</div>

internally in the nodes you have called one `life360-server` and the other just `location` - this second one may very well conflict with another node of same name/type.

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [10 November 2020 15:54 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/74 "2020-11-10T15:54:44Z")

</div>

Thanks @dceejay,

So is this an example of the only places relevant to eliminate the overlap?:

```auto
nodes/server.html: RED.nodes.registerType(' **life360-server**', {
nodes/server.html:<script type="text/x-red" data-template-name=" **life360-server**">
nodes/server.js: RED.nodes.registerType(" **life360-server**", ServerNode);

```

(wow - emphasis from the shell was maintained in the paste to the forum. That's impressive, if that's what actually happened.)

---

<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:** [10 November 2020 16:38 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/75 "2020-11-10T16:38:33Z")

</div>

Well actually I suspect the other (location) one more as that would be less unique - but yes those.

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [10 November 2020 16:57 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/76 "2020-11-10T16:57:52Z")

</div>

Sure. Just trying to identify what discretely needs to be unique across all possible node, and that one would not be unique WRT the parent repo and I suspect is probably why I see that "Type already registered" message twice.

I was struggling this morning to decide what to rename the location node to. The most descriptive name would be something that says all the things, e.g. "arrival and departure event triggers". I was trying to come up with a word that means both arrival and departure and the closest I came up with was 'aloha', but that's too niche. Perhaps just 'life360' or 'location-events' or 'location-changes'...

I'm open to suggestions.

---

<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:** [10 November 2020 17:38 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/77 "2020-11-10T17:38:38Z")

</div>

well as it's to do with life360 and location maybe life36-location-events ?

---

<div class="post-metadata">

**Author:** ![Prog72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/prog72/32/31578_2.png) [@Prog72](https://discourse.nodered.org/u/Prog72)\
**Post date:** [10 November 2020 17:42 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/78 "2020-11-10T17:42:21Z")

</div>

"Circle Activity" perhaps?

---

<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:** [10 November 2020 18:37 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/79 "2020-11-10T18:37:29Z")

</div>

It really doesn’t matter as long as it is probably unique.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 November 2020 18:37 UTC](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434/80 "2020-11-24T18:37:33Z")

</div>

Closed on 24 November 2020 18:37 UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/dumb-question-about-editing-a-node/34434.md?page=3)
