Architecting Angular Applications with Redux,RxJS,and NgRx
上QQ阅读APP看书,第一时间看更新

Creating a selection view

First off we need our view in which we will perform the selection:

// demo/selectionView.js

import dispatcher from "./dispatcher";

console.log('selection view loaded');

class SelectionView {
selectIndex(index) {
console.log('selected index ', index);
dispatcher.dispatch({

type: "SELECT_INDEX",
data: index

});
}
}

const view = new SelectionView();
export default view;

We have bolded the   selectIndex()   method above that we intend to use.