ConceptPortal-public/rsconcept/frontend/src/utils/utils.tsx

10 lines
260 B
TypeScript
Raw Normal View History

2023-07-15 17:46:19 +03:00
export function assertIsNode(e: EventTarget | null): asserts e is Node {
if (!e || !('nodeType' in e)) {
2023-07-25 20:27:29 +03:00
throw new Error('Node expected');
2023-07-15 17:46:19 +03:00
}
}
2023-07-25 20:27:29 +03:00
export async function delay(ms: number) {
return await new Promise(resolve => setTimeout(resolve, ms));
}