| 1 | import { createAsync, query } from "@solidjs/router"; |
| 2 | |
| 3 | function wait<T>(ms: number, data: T): Promise<T> { |
| 4 | return new Promise((resolve) => setTimeout(resolve, ms, data)); |
| 5 | } |
| 6 | |
| 7 | function random(min: number, max: number): number { |
| 8 | return Math.floor(Math.random() * (max - min + 1)) + min; |
| 9 | } |
| 10 | |
| 11 | const getName = query(() => wait(random(500, 1000), "Solid"), "aboutName"); |
| 12 | |
| 13 | const AboutData = () => { |
| 14 | return createAsync(() => getName()); |
| 15 | }; |
| 16 | |
| 17 | export default AboutData; |
| 18 | export type AboutDataType = typeof AboutData; |