aboutsummaryrefslogtreecommitdiff
path: root/common/stored_types.js
blob: e04377729cb24ac8101d49a430a47c897edbc798 (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
37
38
39
40
41
/**
 * Myext stored item types "enum"
 *
 * Copyright (C) 2021 Wojtek Kosior
 * Redistribution terms are gathered in the `copyright' file.
 */

/*
 * Key for item that is stored in quantity (script, page) is constructed by
 * prepending its name with first letter of its list name. However, we also
 * need to store some items that don't belong to any list. Let's call them
 * persisted variables. In such case item's key is its "name" prepended with
 * an underscore.
 */

"use strict";

(() => {
    const TYPE_PREFIX = {
	PAGE : "p",
	BAG : "b",
	SCRIPT : "s",
	VAR : "_"
    };

    const TYPE_NAME = {
	[TYPE_PREFIX.PAGE] : "page",
	[TYPE_PREFIX.BAG] : "bag",
	[TYPE_PREFIX.SCRIPT] : "script"
    }

    const list_prefixes = [
	TYPE_PREFIX.PAGE,
	TYPE_PREFIX.BAG,
	TYPE_PREFIX.SCRIPT
    ];

    window.TYPE_PREFIX = TYPE_PREFIX;
    window.TYPE_NAME = TYPE_NAME;
    window.list_prefixes = list_prefixes;
})();