Doing that will set a 'data' property on this.options -- so if you pass an observable then you can do "{data} change". It might work to listen for "{data.stateParams} change" if your 'data' is observable, but I haven't tested that myself.Aren't I doing this by passing an options object when instantiating the control? new someControl( '.domEl', { data: data } );
A nicer option, if you can do it, would be to pass stateParams directly as an option when invoking the Control. This will set up this.options.stateParams, which means "{stateParams} change" will work.
- new WhateverControl('.domEl', {
- stateParams: data.stateParams
- });
It will work -- I just mis-explained it. Previously I thought that you had to have this.options.stateParams set before init(), but after reading the docs I realized that you have to have it set before setup(). (The code will be the same either way, though, since setup() calls init().)So we think this won't work?Edit: Oops -- apparently the parent's setup() is responsible for setting up the event bindings for "{property} change" callbacks, not init() as I thought above.