Profile: supports webfinger
* timelines: add emptyTimeline
This commit is contained in:
parent
f860baa376
commit
7153a1fec1
2 changed files with 96 additions and 14 deletions
|
@ -248,6 +248,64 @@ export type TimelineResource<R> = [
|
|||
{ refetch(info?: TimelineFetchDirection): void },
|
||||
];
|
||||
|
||||
export const emptyTimeline = {
|
||||
list() {
|
||||
return emptyTimeline;
|
||||
},
|
||||
|
||||
setDirection() {
|
||||
return emptyTimeline;
|
||||
},
|
||||
|
||||
async next(): Promise<IteratorResult<any, undefined>> {
|
||||
return {
|
||||
value: undefined,
|
||||
done: true,
|
||||
};
|
||||
},
|
||||
|
||||
getDirection(): TimelineFetchDirection {
|
||||
return "next";
|
||||
},
|
||||
|
||||
clone() {
|
||||
return emptyTimeline;
|
||||
},
|
||||
|
||||
async return(): Promise<IteratorResult<any, undefined>> {
|
||||
return {
|
||||
value: undefined,
|
||||
done: true,
|
||||
};
|
||||
},
|
||||
|
||||
async throw(e?: unknown) {
|
||||
throw e;
|
||||
},
|
||||
|
||||
async *values() {},
|
||||
async *[Symbol.asyncIterator](): AsyncIterator<any[], undefined> {
|
||||
return undefined;
|
||||
},
|
||||
|
||||
async then<TNext, ENext>(
|
||||
onresolve?: null | ((value: any[]) => TNext | PromiseLike<TNext>),
|
||||
onrejected?: null | ((reason: unknown) => ENext | PromiseLike<ENext>),
|
||||
) {
|
||||
try {
|
||||
if (!onresolve) {
|
||||
throw new TypeError("no onresolve");
|
||||
}
|
||||
return await onresolve([]);
|
||||
} catch (reason) {
|
||||
if (!onrejected) {
|
||||
throw reason;
|
||||
}
|
||||
return await onrejected(reason);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Create auto managed timeline controls.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue