Frog.image Context
The c
object is the parameter of the route handlers.
import { Frog } from 'frog'
export const app = new Frog({ title: 'Frog Frame' })
app.image('/', (c) => {
return c.res({/* ... */})
})
previousButtonValues
- Type:
string[]
The data of the previous intents.
import { Button, Frog } from 'frog'
export const app = new Frog({
title: 'Frog Frame'
})
app.frame('/', (c) => {
const { previousButtonValues } = c
return c.res({/* ... */})
})
previousState
- Type:
State
The state of the previous frame.
import { Button, Frog } from 'frog'
type State = {
values: string[]
}
export const app = new Frog<{ State: State }>({
initialState: {
values: []
},
title: 'Frog Frame',
})
app.frame('/', (c) => {
const { previousState } = c
return c.res({/* ... */})
})
req
- Type:
Request
import { Button, Frog } from 'frog'
export const app = new Frog({ title: 'Frog Frame' })
app.image('/', (c) => {
const { req } = c
return c.res({/* ... */})
})
res
- Type:
(response: ImageResponse) => ImageResponse
The image response.
import { Button, Frog } from 'frog'
export const app = new Frog({ title: 'Frog Frame' })
app.image('/', (c) => {
return c.res({/* ... */})
})
var
- Type:
HonoContext['var']
Extract a context value that was previously set via set
in Middleware.
import { Button, Frog } from 'frog'
export const app = new Frog({ title: 'Frog Frame' })
app.use(async (c, next) => {
c.set('message', 'Frog is cool!!')
await next()
})
app.image('/', (c) => {
const message = c.var.message
return c.res({/* ... */})
})