magic: added a way for running async functions in the top level jsx code
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { Problem, Solution, User } from './model'
|
||||
|
||||
export type DatabaseConnection = {
|
||||
getProblem(id: string): Promise<Problem | null>
|
||||
}
|
||||
|
||||
export type Database = {
|
||||
users: Record<string, User>
|
||||
problems: Record<string, Problem>
|
||||
solutions: Record<string, Solution>
|
||||
}
|
||||
+6
-1
@@ -1,6 +1,11 @@
|
||||
import { DatabaseConnection } from './database'
|
||||
|
||||
export type ServerAsyncCallback = () => Promise<void>
|
||||
|
||||
export type RenderedPage = {
|
||||
html: string
|
||||
metadata: any
|
||||
asyncCallbacks: ServerAsyncCallback[]
|
||||
}
|
||||
|
||||
export type RenderFunction = (url: string) => RenderedPage
|
||||
export type RenderFunction = (url: string, db: DatabaseConnection) => RenderedPage
|
||||
|
||||
Reference in New Issue
Block a user