mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-22 07:07:53 +00:00
feat(shell): api: support api.has()
This commit is contained in:
parent
f62febad1e
commit
73164c4cdc
@ -21,6 +21,8 @@ export type Api = {
|
|||||||
method: M,
|
method: M,
|
||||||
impl: (...args: Methods[M][0]) => Promise<Methods[M][1]>,
|
impl: (...args: Methods[M][0]) => Promise<Methods[M][1]>,
|
||||||
) => void
|
) => void
|
||||||
|
|
||||||
|
has: <M extends keyof Methods>(method: M) => boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildNotimpl = (name: string) => {
|
const buildNotimpl = (name: string) => {
|
||||||
@ -74,3 +76,5 @@ api.register =
|
|||||||
api[method].engine = engine
|
api[method].engine = engine
|
||||||
api[method].priority = newPriority
|
api[method].priority = newPriority
|
||||||
}
|
}
|
||||||
|
|
||||||
|
api.has = <M extends keyof Methods>(method: M) => !api[method].notimpl
|
||||||
|
Loading…
Reference in New Issue
Block a user