summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/third_party/polymer2/bower_components/polymer-redux/demo/redux-mixin.html
blob: 01902220aec4430748ea4660bdca264991ce8bb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<link rel="import" href="../polymer-redux.html">
<script src="../node_modules/redux/dist/redux.js"></script>
<script>
	const initial = {
		message: 'Hello from PolymerRedux',
		foo: 'I am a Foo',
		bar: 'I just got Bar\'d'
	};
	const reducer = (state = initial, action) => {
		switch (action.type) {
			case 'UPDATE_MESSAGE':
				return Object.assign({}, state, {
					message: action.message
				});

			default:
				return state;
		}
	};
	const store = Redux.createStore(reducer);
	ReduxMixin = PolymerRedux(store);
</script>