This repository has been archived on 2020-04-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Vim-Vixen/src/background/repositories/BookmarkRepository.ts
2019-05-19 21:34:08 +09:00

18 lines
398 B
TypeScript

import { injectable } from 'tsyringe';
@injectable()
export default class BookmarkRepository {
async create(
title: string, url: string
): Promise<browser.bookmarks.BookmarkTreeNode> {
let item = await browser.bookmarks.create({
type: 'bookmark',
title,
url,
});
if (!item) {
throw new Error('Could not create a bookmark');
}
return item;
}
}