Project

General

Profile

Download (918 Bytes) Statistics
| Branch: | Tag: | Revision:

haketilo / common / stored_types.js @ b93f26bf

1
/**
2
 * Myext stored item types "enum"
3
 *
4
 * Copyright (C) 2021 Wojtek Kosior
5
 * Redistribution terms are gathered in the `copyright' file.
6
 */
7

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

    
16
"use strict";
17

    
18
(() => {
19
    const TYPE_PREFIX = {
20
	PAGE : "p",
21
	BAG : "b",
22
	SCRIPT : "s",
23
	VAR : "_"
24
    };
25

    
26
    const TYPE_NAME = {
27
	[TYPE_PREFIX.PAGE] : "page",
28
	[TYPE_PREFIX.BAG] : "bag",
29
	[TYPE_PREFIX.SCRIPT] : "script"
30
    }
31

    
32
    const list_prefixes = [
33
	TYPE_PREFIX.PAGE,
34
	TYPE_PREFIX.BAG,
35
	TYPE_PREFIX.SCRIPT
36
    ];
37

    
38
    window.TYPE_PREFIX = TYPE_PREFIX;
39
    window.TYPE_NAME = TYPE_NAME;
40
    window.list_prefixes = list_prefixes;
41
})();
(8-8/9)