docs: use `defineLazyHandler` in wasm example (#5797)

This commit is contained in:
Cupid Valentine 2022-07-11 16:41:56 +08:00 committed by GitHub
parent c695f71ed3
commit ac4e09b36b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -1,13 +1,13 @@
import { useQuery, lazyHandle } from 'h3'
import { defineLazyHandler } from 'h3'
export default lazyHandle(async () => {
export default defineLazyHandler(async () => {
const { exports: { sum } } = await loadWasmInstance(
// @ts-ignore
() => import('~/server/wasm/sum.wasm')
)
return (req) => {
const { a = 0, b = 0 } = useQuery(req)
return (event) => {
const { a = 0, b = 0 } = useQuery(event)
return { sum: sum(a, b) }
}
})