The video uses a specific AI coding tool to demonstrate the setup, but the configuration works 1:1 with Cursor, Claude Code, or any other tool. Despia is web framework and tooling agnostic, so the only things that matter are the global JavaScript function you define and the shortcut configuration in the Despia Editor that calls it.
Installation
Quick Actions does not require installing thedespia-native package. The runtime invokes your global function directly when the shortcut fires, no SDK calls or imports needed on your side. Install despia-native only if your page also uses other Despia schemes.
- Bundle
- CDN
How it works
Two pieces have to line up. First, attach the function you want the shortcut to trigger as a global onwindow. Second, configure a Quick Action in the Despia Editor that calls that function. The runtime picks up the configuration during the build and wires the shortcut to invoke your function on tap.
Despia Editor setup
Configure the shortcut in the Despia Editor under Add-ons > Hard Coded > Quick Actions. Each shortcut has a label, an icon, an optional Quick Link, and a JavaScript snippet that the runtime executes on tap.Open Quick Actions
In the Despia Editor, navigate to Add-ons > Hard Coded > Quick Actions and click Add New.
Name the shortcut
Give it a short, action-oriented label like
Don't Leave, Track Macros, or Scan Invoice. This is the text the user sees in the long-press menu.Select an icon
Choose an icon from the picker that visually matches the action. The icon shows next to the label in the long-press menu.
Leave Quick Link empty
Skip the Quick Link field. It is only for shortcuts that should navigate to a specific URL on tap, which is not what you are doing here. Your function call will handle the action.
Add the JavaScript
In the JavaScript editor, call your global function inside the commented section:Replace
dontLeave with whatever name you used for your global function in the web app. The function name has to match exactly.Define the global function
The function attaches towindow directly. In a vanilla HTML page you can write window.dontLeave = function() { ... } at any point before the user could possibly tap the shortcut. In a React or other framework app, attach inside a top-level useEffect so the function lands on window once the app mounts and stays there for the rest of the session.
window before any user interaction is possible.
Pass arguments via the function body
The Despia Editor JavaScript field executes the snippet you put there as a literal expression, so you can pass hardcoded arguments to your function if one shortcut should always do one specific thing. This unlocks “one function, many shortcut variations” without defining a new global per shortcut.Resources
NPM Package
despia-native