Using the JavaScript SDK

A Software Development Kit (SDK) is a collection of development tools you can use to build your app for a specific platform.

Our JavaScript SDK exposes methods that enable your app to communicate with the Wix platform – including the Editor, internal Dashboard, live site, and preview.

Implementation

To use our SDK, include the following script tag in your HTML document:
1
<script type="text/javascript" src="//static.parastorage.com/services/js-sdk/1.537.0/js/wix.min.js"></script>

Once included, your window object will contain a new global Object named Wix.

Note:
We've deprecated our UI-library and starter template. It's no longer maintained, therefore you should feel free to defer to your own UI guidelines. Continuing to use these is at your own risk.

SDK version

We release new versions of our JavaScript SDK regularly. Update your app to use the latest version by replacing the version number in the script tag. Note the following:
  • We document the latest SDK version for each method: If a method is updated, we update its SDK version accordingly. For example: if a method is available since SDK 1.45.0 and updated in SDK 1.95, our documentation lists SDK 1.95 as the version. Update your app to the latest version so that you can use all parameters in the method.
  • When calling a method from the Editor, check the Editor version: Starting from SDK 1.45.0, methods are not supported in the old Editor. When using more recent methods in the Editor, provide a fallback option for users in the old Editor. Keep reading to learn more.

Structure

The Wix global object can be used in all components’ endpoints – Widget, Page, internal Dashboard, Worker, and App Settings – as well as its controls – Modal and Popup. However, some of its functions make sense only in certain endpoints.

For functionality that is limited to a specific endpoint, we created a unique endpoint to hold them. 
For example, Wix.Settings holds all the functions that are valid specifically in the App Settings endpoint (which is the only one that resides in the Editor).

Another special namespace is the Wix.Utils, which provides utility functions that can be called by all endpoints except worker.
Note:
Although Wix.Utils is valid for all endpoints (except worker), if the called function doesn’t have a meaningful value to return, it returns null. E.g., when Wix.Utils.getOrigCompId() is used in the App Settings endpoint, the function returns the component ID that called it – but for other endpoints, it returns null.

Async methods

If you see a method in our SDK has a callback function, this means that the method is asynchronous. The “return” value is passed as an argument in the callback function.

SDK documentation

Review our SDK documentation.