* test(storybook): add `components/MkC.*` stories * test(storybook): add some tests * test: add sleep * test: comment-out flaky test * test(storybook): add test for `MkChannelFollowButton` * chore(storybook): tweak sleep duration in `MkChannelFollowButton` story test * fix(chromatic): add delay to `MkChannelList` * chore: replace `mswDecorator` with `mswLoader` * fix(storybook): tweak some parameters * chore: serve static files * fix(chromatic): add delay to `MkCwButton` * chore: delete logging for debug * fix: add right click in `MkContextMenu` play * refactor: remove unused imports
This commit is contained in:
@@ -7,3 +7,13 @@ export async function tick(): Promise<void> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
await new Promise((globalThis.requestIdleCallback ?? setTimeout) as never);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/misskey-dev/misskey/issues/11267
|
||||
*/
|
||||
export function semaphore(counter = 0, waiting: (() => void)[] = []) {
|
||||
return {
|
||||
acquire: () => ++counter > 1 && new Promise<void>(resolve => waiting.push(resolve)),
|
||||
release: () => --counter && waiting.pop()?.(),
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user