Project

General

Profile

Download (1.05 KB) Statistics
| Branch: | Tag: | Revision:

haketilo / common / stored_types.js @ 2bd35bc4

1
/**
2
 * This file is part of Haketilo.
3
 *
4
 * Function: Define an "enum" of stored item types.
5
 *
6
 * Copyright (C) 2021 Wojtek Kosior
7
 * Redistribution terms are gathered in the `copyright' file.
8
 */
9

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

    
18
const TYPE_PREFIX = {
19
    REPO: "r",
20
    PAGE : "p",
21
    BAG : "b",
22
    SCRIPT : "s",
23
    VAR : "_",
24
    /* Url prefix is not used in stored settings. */
25
    URL : "u"
26
};
27

    
28
const TYPE_NAME = {
29
    [TYPE_PREFIX.REPO] : "repo",
30
    [TYPE_PREFIX.PAGE] : "page",
31
    [TYPE_PREFIX.BAG] : "bag",
32
    [TYPE_PREFIX.SCRIPT] : "script"
33
}
34

    
35
const list_prefixes = [
36
    TYPE_PREFIX.REPO,
37
    TYPE_PREFIX.PAGE,
38
    TYPE_PREFIX.BAG,
39
    TYPE_PREFIX.SCRIPT
40
];
41

    
42
/*
43
 * EXPORTS_START
44
 * EXPORT TYPE_PREFIX
45
 * EXPORT TYPE_NAME
46
 * EXPORT list_prefixes
47
 * EXPORTS_END
48
 */
(16-16/16)