new method registerMethod, that allows to register event-listener at
runtime