module.exports.bindIrcEvents = function (events_scope, event_map, context, irc_connection) {
var namespace_prefix = events_scope ?
- events_scope + ':' :
+ events_scope + ' ' :
'';
// Make sure we have a holder for the bound events
// Bind the event to `context`, storing it with the event listing
if (!event_map._bound_events[event_name]) {
- event_map._bound_events[event_name] = fn.bind(context);
+ event_map._bound_events[event_name] = _.bind(fn, context);
}
// Add the listener to the IRC connection object
module.exports.unbindIrcEvents = function (events_scope, event_map, irc_connection) {
var namespace_prefix = events_scope ?
- events_scope + ':' :
+ events_scope + ' ' :
'';
// No bound events? Then we have nothing to do
irc_connection.removeListener(namespace_prefix + event_name, event_map._bound_events[event_name]);
// Remove the bound function as no longer needed
- event_map._bound_events[event_name] = undefined;
+ delete event_map._bound_events[event_name];
}
});
+
+ delete event_map._bound_events;
};
\ No newline at end of file