Register and unregister an event handler for the event when the camera changes (rotate, zoom, pan, change the projection mode, resize the browser window).
Demo