aboutsummaryrefslogtreecommitdiff
path: root/src/shared/actions.js
blob: bb61dbc9480c8a3dadd27a1d289712fb391b9633 (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
export const CMD_OPEN = 'cmd.open';
export const CMD_TABS_OPEN = 'cmd.tabs.open';
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 SCROLL_UP = 'scroll.up';
export const SCROLL_DOWN = 'scroll.down';
export const SCROLL_TOP = 'scroll.top';
export const SCROLL_BOTTOM = 'scroll.bottom';
export const FOLLOW_START = 'follow.start';

const BACKGROUND_ACTION_SET = new Set([
  TABS_CLOSE,
  TABS_REOPEN,
  TABS_PREV,
  TABS_NEXT
]);

const CONTENT_ACTION_SET = new Set([
  CMD_OPEN,
  CMD_TABS_OPEN,
  SCROLL_UP,
  SCROLL_DOWN,
  SCROLL_TOP,
  SCROLL_BOTTOM,
  FOLLOW_START
]);

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

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