Comparison

util/pubsub.lua @ 8312:6fd36e73082b

util.pubsub: Clear data on node deletion
author Kim Alvefur <zash@zash.se>
date Mon, 09 Oct 2017 01:57:55 +0200
parent 8297:ac5c90230c2c
child 8316:8648cb171213
comparison
equal deleted inserted replaced
8311:df8c82d285dc 8312:6fd36e73082b
242 local node_obj = self.nodes[node]; 242 local node_obj = self.nodes[node];
243 if not node_obj then 243 if not node_obj then
244 return false, "item-not-found"; 244 return false, "item-not-found";
245 end 245 end
246 self.nodes[node] = nil; 246 self.nodes[node] = nil;
247 if self.data[node] and self.data[node].clear then
248 self.data[node]:clear();
249 end
247 self.data[node] = nil; 250 self.data[node] = nil;
248 self.events.fire_event("node-deleted", { node = node, actor = actor }); 251 self.events.fire_event("node-deleted", { node = node, actor = actor });
249 self.config.broadcaster("delete", node, node_obj.subscribers); 252 self.config.broadcaster("delete", node, node_obj.subscribers);
250 return true; 253 return true;
251 end 254 end