hyper/lib/actions/header.js

52 lines
939 B
JavaScript
Raw Normal View History

import {CLOSE_TAB, CHANGE_TAB} from '../constants/tabs';
import {UI_WINDOW_MAXIMIZE, UI_WINDOW_UNMAXIMIZE} from '../constants/ui';
import rpc from '../rpc';
2016-07-13 12:44:24 -08:00
import {userExitSession, setActiveSession} from './sessions';
export function closeTab(uid) {
return dispatch => {
2016-07-13 12:44:24 -08:00
dispatch({
type: CLOSE_TAB,
uid,
effect() {
2016-07-13 12:44:24 -08:00
dispatch(userExitSession(uid));
}
});
};
}
export function changeTab(uid) {
return dispatch => {
2016-07-13 12:44:24 -08:00
dispatch({
type: CHANGE_TAB,
uid,
effect() {
2016-07-13 12:44:24 -08:00
dispatch(setActiveSession(uid));
}
});
};
}
export function maximize() {
return dispatch => {
dispatch({
type: UI_WINDOW_MAXIMIZE,
effect() {
rpc.emit('maximize');
}
});
};
}
export function unmaximize() {
return dispatch => {
dispatch({
type: UI_WINDOW_UNMAXIMIZE,
effect() {
rpc.emit('unmaximize');
}
});
};
}