| return c | return c | ||||
| return None | return None | ||||
| def listen(self, signal, callback_fn): | |||||
| try: | |||||
| Events.listen(signal, callback_fn) | |||||
| except Exception as e: | |||||
| raise e | |||||
| def unlisten(self, signal, callback_fn): | |||||
| Events.unlisten(signal, callback_fn) | |||||
| def emit(self, signal, data={}): | |||||
| # NOTE: I'm currently forcing the existance of this "NODE" key in the dictionary given. Not sure if I'll keep this. | |||||
| data["NODE"] = { | |||||
| "name":self.name | |||||
| "n":self | |||||
| } | |||||
| Events.emit(signal, data) | |||||
| def _init(self): | def _init(self): | ||||
| if hasattr(self, "on_init"): | if hasattr(self, "on_init"): | ||||
| self.on_init() | self.on_init() |