Changing from global variable to Cockpit as the event emitter

So far, the 'cockpitEvenEmitter' was used as a global variable across different parts of the software.
This is bad practice and it shows up on WebStorm as 'undeclared variable'.

I made the Cockpit object inherit from EventEmitter2  and moved all calls.

What do you think?