mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
docs: use defineLazyHandler
in wasm example (#5797)
This commit is contained in:
parent
c695f71ed3
commit
ac4e09b36b
@ -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(
|
const { exports: { sum } } = await loadWasmInstance(
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
() => import('~/server/wasm/sum.wasm')
|
() => import('~/server/wasm/sum.wasm')
|
||||||
)
|
)
|
||||||
|
|
||||||
return (req) => {
|
return (event) => {
|
||||||
const { a = 0, b = 0 } = useQuery(req)
|
const { a = 0, b = 0 } = useQuery(event)
|
||||||
return { sum: sum(a, b) }
|
return { sum: sum(a, b) }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user