blob: 93996be847334fbe4e20c2b8edffd2f642b13da1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import {
authorizeUser,
logoutUser,
postComment,
toggleForm,
COLLAPSE_BUTTON,
COMMENT_BUTTON,
LOGIN,
LOGOUT,
} from '../components';
import { state } from './state';
const noop = () => {};
const eventLookup = ({ target: { id } }) => {
switch (id) {
case COLLAPSE_BUTTON:
return toggleForm;
case COMMENT_BUTTON:
return postComment.bind(null, state);
case LOGIN:
return authorizeUser.bind(null, state);
case LOGOUT:
return logoutUser;
default:
return noop;
}
};
const updateWindowSize = wind => {
state.innerWidth = wind.innerWidth;
state.innerHeight = wind.innerHeight;
};
export { eventLookup, updateWindowSize };
|