Skip to content

Instantly share code, notes, and snippets.

@odoe
Created September 14, 2015 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odoe/9bb4c55539f305572b21 to your computer and use it in GitHub Desktop.
Save odoe/9bb4c55539f305572b21 to your computer and use it in GitHub Desktop.
import Model from './Model';
import Component from './components/ViewProxy';
// Controller links Model and view
class Controller {
constructor(extent) {
this.model = new Model({ extent: extent });
this.view = new Component({
position: 'topright',
xmin: this.model.extent.xmin,
ymin: this.model.extent.ymin,
xmax: this.model.extent.xmax,
ymax: this.model.extent.ymax
});
this.model.watch('extent', (val) => {
this.view.update({
xmin: val.xmin,
ymin: val.ymin,
xmax: val.xmax,
ymax: val.ymax
});
});
}
};
export default Controller;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment