timgfx Posted June 11, 2016 Report Posted June 11, 2016 The title says it. I am making a bot which you can manage on a webpage. So every time you restart the bot it should remove and add the event listeners again. Quote
timgfx Posted June 11, 2016 Author Report Posted June 11, 2016 Thanks! https://nodejs.org/api/events.html Quote
timgfx Posted June 11, 2016 Author Report Posted June 11, 2016 https://nodejs.org/api/events.htmlI still don't get it. Can you maybe help? :/ Quote
Dr. McKay Posted June 11, 2016 Report Posted June 11, 2016 https://nodejs.org/api/events.html#events_emitter_removelistener_eventname_listener Quote
timgfx Posted June 11, 2016 Author Report Posted June 11, 2016 (edited) https://nodejs.org/api/events.html#events_emitter_removelistener_eventname_listenerYeah I get that but how do I remove steam-user listeners once they've been set. I've tried client.removeListener('loggedOn') but I got a lot of errors. I also tried searching in the steam-user files but what I tried didn't work either. "require('util').inherits(SteamUser, require('events').EventEmitter);" Edited June 11, 2016 by timgfx Quote
Dr. McKay Posted June 11, 2016 Report Posted June 11, 2016 As per the documentation, you need to pass the actual function that you want to remove as a listener to removeListener. Quote
timgfx Posted June 12, 2016 Author Report Posted June 12, 2016 As per the documentation, you need to pass the actual function that you want to remove as a listener to removeListener.I tried that but it didn't work I did this: client.on("loggedOn", function(details, parental) { logonfunc(details, parental); }); client.removeListener("loggedOn", function(details, parental) { logonfunc(details, parental); }); And tried the same with removing the logonfunc function. How would I do it because I'm lost Quote
Dr. McKay Posted June 12, 2016 Report Posted June 12, 2016 There is an example on the node.js doc page. It has to be the same function, not a copy of the function. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.