mirror of
https://codeberg.org/HPCesia/AstralHalo.git
synced 2025-04-08 17:34:27 +08:00
refactor: declare twikoo global variable
This commit is contained in:
parent
cd6071dbfb
commit
7f7d57b94f
@ -8,8 +8,6 @@ import { CDN } from '@constants/cdn.mjs';
|
||||
<script>
|
||||
import { commentConfig } from '@/config';
|
||||
const twikooConfig = commentConfig.twikoo;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
declare const twikoo: any;
|
||||
|
||||
function setup() {
|
||||
if (typeof twikoo === 'undefined') {
|
||||
@ -17,7 +15,7 @@ import { CDN } from '@constants/cdn.mjs';
|
||||
} else {
|
||||
twikoo.init({
|
||||
el: '#twikoo-wrap',
|
||||
...twikooConfig,
|
||||
...twikooConfig!,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
35
src/global.d.ts
vendored
35
src/global.d.ts
vendored
@ -4,4 +4,39 @@ declare global {
|
||||
interface Window {
|
||||
swup: Swup;
|
||||
}
|
||||
|
||||
const twikoo: {
|
||||
init: (options: {
|
||||
envId: string;
|
||||
el: string;
|
||||
region?: string;
|
||||
path?: string;
|
||||
lang?: string;
|
||||
onCommentLoaded?: () => void;
|
||||
}) => Promise<void>;
|
||||
getCommentsCount: (options: {
|
||||
envId: string;
|
||||
urls: string[];
|
||||
includeReply?: boolean;
|
||||
}) => Promise<{ url: string; count: number }[]>;
|
||||
getRecentComments: (options: {
|
||||
envId: string;
|
||||
urls?: string[];
|
||||
pageSize?: number;
|
||||
includeReply?: boolean;
|
||||
}) => Promise<
|
||||
{
|
||||
id: string;
|
||||
url: string;
|
||||
nick: string;
|
||||
mailMd5: string;
|
||||
link: string;
|
||||
comment: string;
|
||||
commentText: string;
|
||||
created: number;
|
||||
avatar: string;
|
||||
relativeTime: string;
|
||||
}[]
|
||||
>;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user