Compare commits
No commits in common. "5ed8673274187958e3bee569aba0d33baf605bb1" and "b9b5641b26dc660685e9dc88d283b3227c628b7e" have entirely different histories.
5ed8673274
...
b9b5641b26
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@because/hype",
|
||||
"version": "0.0.1",
|
||||
"name": "@_because/hype",
|
||||
"version": "0.1.2",
|
||||
"module": "src/index.tsx",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
|
|
@ -26,4 +26,4 @@
|
|||
"hono": "^4.10.4",
|
||||
"kleur": "^4.1.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -24,10 +24,9 @@ export type HypeProps = {
|
|||
reset?: boolean
|
||||
prettyHTML?: boolean
|
||||
layout?: boolean
|
||||
router?: boolean
|
||||
}
|
||||
|
||||
type InternalProps = HypeProps & { _isRouter?: boolean }
|
||||
|
||||
export type SSEHandler<E extends Env> = (
|
||||
send: (data: unknown, event?: string) => Promise<void>,
|
||||
c: Context<E>
|
||||
|
|
@ -42,17 +41,12 @@ export class Hype<
|
|||
middlewareRegistered = false
|
||||
routesRegistered = false
|
||||
|
||||
constructor(props?: InternalProps & ConstructorParameters<typeof Hono<E, S, BasePath>>[0]) {
|
||||
constructor(props?: HypeProps & ConstructorParameters<typeof Hono<E, S, BasePath>>[0]) {
|
||||
super(props)
|
||||
|
||||
this.props = props ?? {}
|
||||
if (!props?._isRouter) {
|
||||
if (!this.props.router)
|
||||
this.registerMiddleware()
|
||||
}
|
||||
}
|
||||
|
||||
static router<E extends Env = Env>(): Hype<E> {
|
||||
return new Hype<E>({ _isRouter: true })
|
||||
}
|
||||
|
||||
sse(path: string, handler: SSEHandler<E>) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user