Why not doing this when registering the listener instead, to register it only when needed ?