how about?
```
if (typeof event !== 'object' || !isValidType(event.type))
  return false;

g_media_server_manager_listeners[event.type].forEach(function(callback) {
...
```