diff options
author | Wojtek Kosior <wk@koszkonutek-tmp.pl.eu.org> | 2021-05-12 16:00:09 +0200 |
---|---|---|
committer | Wojtek Kosior <wk@koszkonutek-tmp.pl.eu.org> | 2021-05-12 16:00:09 +0200 |
commit | 7f368d46ea06164da025c1ac4ed9a65ad23b25ef (patch) | |
tree | e5b740ebcb3cdc58e9c87f25556c20d8bfdccadd /common/stored_types.js | |
parent | 89db6823fae5099816732c3cd2ba39700c1c4607 (diff) | |
download | browser-extension-7f368d46ea06164da025c1ac4ed9a65ad23b25ef.tar.gz browser-extension-7f368d46ea06164da025c1ac4ed9a65ad23b25ef.zip |
stop using js modules
Diffstat (limited to 'common/stored_types.js')
-rw-r--r-- | common/stored_types.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/common/stored_types.js b/common/stored_types.js new file mode 100644 index 0000000..de0ec71 --- /dev/null +++ b/common/stored_types.js @@ -0,0 +1,44 @@ +/** + * Myext stored item types "enum" + * + * Copyright (C) 2021 Wojtek Kosior + * + * Dual-licensed under: + * - 0BSD license + * - GPLv3 or (at your option) any later version + */ + +/* + * 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", + BUNDLE : "b", + SCRIPT : "s", + VAR : "_" + }; + + const TYPE_NAME = { + [TYPE_PREFIX.PAGE] : "page", + [TYPE_PREFIX.BUNDLE] : "bundle", + [TYPE_PREFIX.SCRIPT] : "script" + } + + const list_prefixes = [ + TYPE_PREFIX.PAGE, + TYPE_PREFIX.BUNDLE, + TYPE_PREFIX.SCRIPT + ]; + + window.TYPE_PREFIX = TYPE_PREFIX; + window.TYPE_NAME = TYPE_NAME; + window.list_prefixes = list_prefixes; +})(); |