aboutsummaryrefslogtreecommitdiff
path: root/src/shared/actions.js
blob: 7151dd142e23562d462e4c6c478fa0f5f8bb631c (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
export const CMD_OPEN = 'cmd.open';
export const CMD_TABS_OPEN = 'cmd.tabs.open';
export const CMD_BUFFER = 'cmd.buffer';
export const TABS_CLOSE = 'tabs.close';
export const TABS_REOPEN = 'tabs.reopen';
export const TABS_PREV = 'tabs.prev';
export const TABS_NEXT = 'tabs.next';
export const TABS_RELOAD = 'tabs.reload';
export const SCROLL_LINES = 'scroll.lines';
export const SCROLL_PAGES = 'scroll.pages';
export const SCROLL_TOP = 'scroll.top';
export const SCROLL_BOTTOM = 'scroll.bottom';
export const SCROLL_LEFT= 'scroll.left';
export const SCROLL_RIGHT= 'scroll.right';
export const FOLLOW_START = 'follow.start';
export const HISTORY_PREV = 'history.prev';
export const HISTORY_NEXT = 'history.next';
export const ZOOM_IN = 'zoom.in';
export const ZOOM_OUT = 'zoom.out';
export const ZOOM_NEUTRAL = 'zoom.neutral';

const BACKGROUND_ACTION_SET = new Set([
  TABS_CLOSE,
  TABS_REOPEN,
  TABS_PREV,
  TABS_NEXT,
  TABS_RELOAD,
  ZOOM_IN,
  ZOOM_OUT,
  ZOOM_NEUTRAL
]);

const CONTENT_ACTION_SET = new Set([
  CMD_OPEN,
  CMD_TABS_OPEN,
  CMD_BUFFER,
  SCROLL_LINES,
  SCROLL_PAGES,
  SCROLL_TOP,
  SCROLL_BOTTOM,
  SCROLL_LEFT,
  SCROLL_RIGHT,
  FOLLOW_START,
  HISTORY_PREV,
  HISTORY_NEXT
]);

export const isBackgroundAction = (action) => {
  return BACKGROUND_ACTION_SET.has(action);
};

export const isContentAction = (action) => {
  return CONTENT_ACTION_SET.has(action);
};