webflow.canForAppMode()Determine if the user has a specified list of App abilities.
Designer Extensions enhance user functionality while adhering to the Designer’s current mode. Each method within the Designer API provides specific capabilities, aligning with actions available in each mode. For more context on this API, see the App Modes docs.
Use this API to proactively query a user’s capabilities based on the Designer mode they are in, to see if they can use a certain feature of your App. There are a number of scenarios when you may use this method, including, but not limited to:
canForAppMode() to check their capabilities before proceeding. This allows you to notify them that the action cannot be performed in the current mode.appModes: Array<AppMode>
A list of AppMode enums to request and see if the user has these abilities. You can find the list here:
These AppMode strings can be accessed via webflow.appModes (e.g., webflow.appModes.canDesign).
Promise<{[key in AppMode]}: boolean>
A Promise that resolves to a record containing the ability being requested, which maps to whether or not the user has that ability.
Let’s build a function that checks if the app can perform the action of inserting an element. If yes, then perform the function; if not, trigger a notification.