Checks if event handler is present before trying to run it
Also renames everything to "event" in order to have a consistent terminology
This commit is contained in:
parent
320b143687
commit
ebf6cc7c8b
1 changed files with 6 additions and 4 deletions
|
@ -142,9 +142,11 @@ weechat.factory('handlers', ['$rootScope', 'colors', function($rootScope, colors
|
|||
$rootScope.buffers = buffers;
|
||||
}
|
||||
|
||||
var handleEvent = function(event) {
|
||||
if (_.has(eventHandlers, event['id'])) {
|
||||
eventHandlers[event['id']](event);
|
||||
}
|
||||
|
||||
var handleEvent = function(message) {
|
||||
types[message['id']](message);
|
||||
}
|
||||
|
||||
var findMetaData = function(message) {
|
||||
|
@ -157,7 +159,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', function($rootScope, colors
|
|||
|
||||
}
|
||||
|
||||
var types = {
|
||||
var eventHandlers = {
|
||||
bufinfo: handleBufferInfo,
|
||||
_buffer_line_added: handleBufferLineAdded,
|
||||
_buffer_opened: handleBufferOpened
|
||||
|
|
Loading…
Reference in a new issue