mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +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(
|
||||
// @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) }
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user