AbstractJavaScriptComponent - how detect setReadOnly() & other state change

When I create an AbstractJavaScriptComponent, the JavaScriptComponentState that goes with it has values for width, height, immediate, readOnly, enable, etc. How do I detect if these have changed so I can be sure to update the correct elements from the shared state.

I have seen the onStateChange function I can create, but do I have to just set all state variables in my object, or can I detect what changed in the state to make a more pointed?

If my sever-side component is detached, can I still get a request to my JS widget so it can do its cleanup?