add info about registering listener and use example in template