mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-16 21:00:22 +00:00
feat(shell): add authData svc
This commit is contained in:
parent
434d7ce7a3
commit
d05928ddba
22
packages/shell/src/services/authData.ts
Normal file
22
packages/shell/src/services/authData.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
declare const authData: {
|
||||||
|
uin: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const task = new Promise<typeof authData>((res) => {
|
||||||
|
const interval: NodeJS.Timeout = setInterval(() => {
|
||||||
|
if ('authData' in globalThis && authData?.uin) {
|
||||||
|
clearInterval(interval)
|
||||||
|
res(authData)
|
||||||
|
}
|
||||||
|
}, 500)
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 {@link authData}。
|
||||||
|
*
|
||||||
|
* 与直接取 {@link authData}
|
||||||
|
* 的不同点在于,此方法保证 {@link authData} 存在。
|
||||||
|
*
|
||||||
|
* @returns {@link authData}。
|
||||||
|
*/
|
||||||
|
export const getAuthData = () => task
|
Loading…
Reference in New Issue
Block a user