aboutsummaryrefslogtreecommitdiff
path: root/src/background/domains
diff options
context:
space:
mode:
Diffstat (limited to 'src/background/domains')
-rw-r--r--src/background/domains/CommandDocs.ts (renamed from src/background/domains/CommandDocs.js)3
-rw-r--r--src/background/domains/CompletionGroup.js14
-rw-r--r--src/background/domains/CompletionGroup.ts7
-rw-r--r--src/background/domains/CompletionItem.js24
-rw-r--r--src/background/domains/CompletionItem.ts7
-rw-r--r--src/background/domains/Completions.js27
-rw-r--r--src/background/domains/GlobalMark.js24
-rw-r--r--src/background/domains/GlobalMark.ts7
-rw-r--r--src/background/domains/Setting.js51
9 files changed, 22 insertions, 142 deletions
diff --git a/src/background/domains/CommandDocs.js b/src/background/domains/CommandDocs.ts
index 734c68e..25ea62a 100644
--- a/src/background/domains/CommandDocs.js
+++ b/src/background/domains/CommandDocs.ts
@@ -8,5 +8,4 @@ export default {
bdeletes: 'Close all tabs matched by keywords',
quit: 'Close the current tab',
quitall: 'Close all tabs',
-};
-
+} as {[key: string]: string};
diff --git a/src/background/domains/CompletionGroup.js b/src/background/domains/CompletionGroup.js
deleted file mode 100644
index 1749d72..0000000
--- a/src/background/domains/CompletionGroup.js
+++ /dev/null
@@ -1,14 +0,0 @@
-export default class CompletionGroup {
- constructor(name, items) {
- this.name0 = name;
- this.items0 = items;
- }
-
- get name() {
- return this.name0;
- }
-
- get items() {
- return this.items0;
- }
-}
diff --git a/src/background/domains/CompletionGroup.ts b/src/background/domains/CompletionGroup.ts
new file mode 100644
index 0000000..1eea7d8
--- /dev/null
+++ b/src/background/domains/CompletionGroup.ts
@@ -0,0 +1,7 @@
+import CompletionItem from './CompletionItem';
+
+export default interface CompletionGroup {
+ name: string;
+ items: CompletionItem[];
+ // eslint-disable-next-line semi
+}
diff --git a/src/background/domains/CompletionItem.js b/src/background/domains/CompletionItem.js
deleted file mode 100644
index c7ad8a1..0000000
--- a/src/background/domains/CompletionItem.js
+++ /dev/null
@@ -1,24 +0,0 @@
-export default class CompletionItem {
- constructor({ caption, content, url, icon }) {
- this.caption0 = caption;
- this.content0 = content;
- this.url0 = url;
- this.icon0 = icon;
- }
-
- get caption() {
- return this.caption0;
- }
-
- get content() {
- return this.content0;
- }
-
- get url() {
- return this.url0;
- }
-
- get icon() {
- return this.icon0;
- }
-}
diff --git a/src/background/domains/CompletionItem.ts b/src/background/domains/CompletionItem.ts
new file mode 100644
index 0000000..657efaa
--- /dev/null
+++ b/src/background/domains/CompletionItem.ts
@@ -0,0 +1,7 @@
+export default interface CompletionItem {
+ readonly caption?: string;
+ readonly content?: string;
+ readonly url?: string;
+ readonly icon?: string;
+ // eslint-disable-next-line semi
+}
diff --git a/src/background/domains/Completions.js b/src/background/domains/Completions.js
deleted file mode 100644
index f399743..0000000
--- a/src/background/domains/Completions.js
+++ /dev/null
@@ -1,27 +0,0 @@
-export default class Completions {
- constructor(groups) {
- this.g = groups;
- }
-
- get groups() {
- return this.g;
- }
-
- serialize() {
- return this.groups.map(group => ({
- name: group.name,
- items: group.items.map(item => ({
- caption: item.caption,
- content: item.content,
- url: item.url,
- icon: item.icon,
- })),
- }));
- }
-
- static empty() {
- return EMPTY_COMPLETIONS;
- }
-}
-
-let EMPTY_COMPLETIONS = new Completions([]);
diff --git a/src/background/domains/GlobalMark.js b/src/background/domains/GlobalMark.js
deleted file mode 100644
index f0586f1..0000000
--- a/src/background/domains/GlobalMark.js
+++ /dev/null
@@ -1,24 +0,0 @@
-export default class GlobalMark {
- constructor(tabId, url, x, y) {
- this.tabId0 = tabId;
- this.url0 = url;
- this.x0 = x;
- this.y0 = y;
- }
-
- get tabId() {
- return this.tabId0;
- }
-
- get url() {
- return this.url0;
- }
-
- get x() {
- return this.x0;
- }
-
- get y() {
- return this.y0;
- }
-}
diff --git a/src/background/domains/GlobalMark.ts b/src/background/domains/GlobalMark.ts
new file mode 100644
index 0000000..1ae912e
--- /dev/null
+++ b/src/background/domains/GlobalMark.ts
@@ -0,0 +1,7 @@
+export default interface GlobalMark {
+ readonly tabId: number;
+ readonly url: string;
+ readonly x: number;
+ readonly y: number;
+ // eslint-disable-next-line semi
+}
diff --git a/src/background/domains/Setting.js b/src/background/domains/Setting.js
deleted file mode 100644
index 106ec0f..0000000
--- a/src/background/domains/Setting.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import DefaultSettings from '../../shared/settings/default';
-import * as settingsValues from '../../shared/settings/values';
-
-export default class Setting {
- constructor({ source, json, form }) {
- this.obj = {
- source, json, form
- };
- }
-
- get source() {
- return this.obj.source;
- }
-
- get json() {
- return this.obj.json;
- }
-
- get form() {
- return this.obj.form;
- }
-
- value() {
- let value = JSON.parse(DefaultSettings.json);
- if (this.obj.source === 'json') {
- value = settingsValues.valueFromJson(this.obj.json);
- } else if (this.obj.source === 'form') {
- value = settingsValues.valueFromForm(this.obj.form);
- }
- if (!value.properties) {
- value.properties = {};
- }
- return { ...settingsValues.valueFromJson(DefaultSettings.json), ...value };
- }
-
- serialize() {
- return this.obj;
- }
-
- static deserialize(obj) {
- return new Setting({ source: obj.source, json: obj.json, form: obj.form });
- }
-
- static defaultSettings() {
- return new Setting({
- source: DefaultSettings.source,
- json: DefaultSettings.json,
- form: {},
- });
- }
-}