@tomiaa/comment
Version:
73 lines (72 loc) • 1.73 kB
TypeScript
export interface Options {
client_id: string;
client_secret: string;
owner: string;
repo: string;
prefix?: string;
}
export interface UserInfo {
access_token: string;
created_at: number;
expires_in: number;
refresh_token: string;
scope: string;
token_type: string;
}
export interface List {
body: string;
created_at: string;
id: number;
in_reply_to_id: number;
source: any;
target: {
issue: {
id: number;
number: string;
title: string;
};
pull_request: any;
};
updated_at: string;
user: {
id: number;
login: string;
name: string;
avatar_url: string;
url: string;
html_url: string;
remark: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
};
}
export declare class Comment {
options: Options;
userInfo: UserInfo | null;
el: Element | null;
textarea: HTMLTextAreaElement;
button: HTMLButtonElement;
ul: HTMLUListElement;
list: List[];
number: string;
constructor(options: Options);
init(): Promise<void>;
login(): void;
getToken(code: string): Promise<void>;
refreshToken(): Promise<void>;
mount(dom: string | Element): Promise<void>;
getList(): Promise<void>;
renderList(list: List[]): void;
onScroll(): void;
formatTime(date: string): string;
publish(): Promise<void>;
}
export default Comment;