Types on src/background

This commit is contained in:
Shin'ya Ueoka 2019-05-01 11:04:24 +09:00
parent 0cffb09e24
commit 678020a3a2
48 changed files with 446 additions and 431 deletions

View file

@ -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};

View file

@ -1,14 +1,7 @@
export default class CompletionGroup {
constructor(name, items) {
this.name0 = name;
this.items0 = items;
}
import CompletionItem from './CompletionItem';
get name() {
return this.name0;
}
get items() {
return this.items0;
}
export default interface CompletionGroup {
name: string;
items: CompletionItem[];
// eslint-disable-next-line semi
}

View file

@ -1,24 +1,7 @@
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;
}
export default interface CompletionItem {
readonly caption?: string;
readonly content?: string;
readonly url?: string;
readonly icon?: string;
// eslint-disable-next-line semi
}

View file

@ -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([]);

View file

@ -1,24 +1,6 @@
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;
}
export interface GlobalMark {
readonly tabId: number;
readonly url: string;
readonly x: number;
readonly y: number;
}