Category: Tutorials
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Where is the documentation on objects of functions of the JS SDK?

Issue

As an individual looking for information on the JS SDK, I am unable to locate documentation on specific functions such as resetWidget or closeModal.

Resolution

To find the documentation for objects and functions of the JS SDK, such as resetWidget or closeModal, one can refer to the framework actions documentation provided. This documentation contains details on all the actions and their respective parameters.

For example, to learn how to use the resetWidget function, one can search for it in the documentation and find that it resets the state of the widget to 'default' and takes an optional callback function as a parameter. Similarly, the closeModal function closes the current modal window and takes an optional parameter for the callback function.

To use these functions in one's code, they can simply call them with the relevant parameters as needed. For example, to reset the widget state and log a message after the reset:

myWidget.resetWidget(() => {
console.log("Widget state has been reset");
});

Or to close the modal window and perform some other action:

myWidget.closeModal(() => {
console.log("Modal closed");
// Perform other actions
});