Editor compatibility
Wix Blocks apps aren't supported in the Wix Harmony editor. Existing Blocks apps remain available for purchase on the Wix App Market for Wix Editor and Wix Studio sites. To learn more, see About Wix Harmony and Blocks.
Add a new function to enable Wix users to perform actions related to the widgets on their websites. For example, a user who has a shopping widget would like to be able to get the address of a certain customer through the function getAddress(customerId) and set the address through the function setAddress(customerId).
To add a new public function to your widget:
Click the Widget API
icon.
Click Add New Public Function or hover over Functions and click the
icon.

Add the code for your function in the code editor, where a new function "foo" appears.
Change the new default name to a meaningful name and edit the function. For example, in the counter tutorial, there is a function that resets the counter and renders it. This is the code in Blocks:
You, or users, can then call the function from the editor. For example, this could be the code in the editor:
Learn more about using your Widget API when editing a site.
When you write your function, make sure to replace the default jsdoc that appears above it with your own one. The user of the widget will see the jsdoc when using the function in a site.