adds warning for this.state, enchances this.state

This commit changes this.state to this._state so that the user never
really touches this._state directly without being warned. It uses ES5
Object.defineProperty for catching the `set` operation. A test is also
added for that.

Closes #2272