Adding a selected view

This view will register itself with the store and ask for updates to its content. If there are any updates it will be notified and the data from the store will be read and this view will communicate what the store value now is:

// demo/selectedView.js

import store from "./store";

console.log('selected view loaded');

class SelectedView {
constructor() {
this.index = 0;
store.addListener(this.notifyChanged.bind(this));
}

notifyChanged() {
this.index = store.getSelectedItem();
console.log('new index is ', this.index);
}
}

const view = new SelectedView();
export default SelectedView;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.51.157