Skip to content

Frog.castAction

Import

import { Frog } from 'frog'

Usage

import { Frog } from 'frog'
 
const app = new Frog({ title: 'Frog Frame' })
 
app.castAction('/', (c) => {
    return c.message({ message: 'Action Succeeded' })
  },
  {
    name: 'My Action',
    icon: 'log'
  }
)

Parameters

path

  • Type: string

Path of the route.

Read more.

import { Frog } from 'frog'
 
const app = new Frog({ title: 'Frog Frame' })
 
app.castAction(
  '/foo/bar',
  (c) => {
    return c.message({ message: 'Action Succeeded' })
  },
  {
    name: 'My Action',
    icon: 'log'
  }
)

handler

  • Type: (c: Context) => CastActionResponse

Handler function for the route.

import { Frog } from 'frog'
 
const app = new Frog({ title: 'Frog Frame' })
 
app.castAction(
  '/foo/bar',
  (c) => {
    return c.message({ message: 'Action Succeeded' })
  },
  { 
    name: 'My Action',
    icon: 'log'
  }
) 

options

  • Type: RouteOptions<'castAction'>

Options for a Cast Action

import { Frog } from 'frog'
 
const app = new Frog({ title: 'Frog Frame' })
 
app.castAction(
  '/foo/bar',
  (c) => {
    return c.message({ message: 'Action Succeeded' })
  },
  { 
    aboutUrl: 'https://frog.fm/reference/frog-cast-action',
    name: 'My Action',
    description: 'My awesome action.',
    icon: 'log'
  }
) 

Context Parameter

See the Cast Action Context API.

Action Response

See the Cast Action Response API.