top of page
This website was created by Code Enhancement Studio
Writer's pictureQuentin Plomteux

Understanding the Difference Between .jsw and .js Files

When it comes to Velo development, there are two types of files that are used: .jsw and .js. While they may look similar, they are actually quite different and serve different purposes.


In this blog post, we’ll take a look at the differences between .jsw and .js files and how they are used in your Wix website.


First, let’s start with .jsw files. These are JavaScript modules that can be called from the frontend, like a Remote Procedure Call (RPC). When a .jsw's function is triggered, it is executed on the server. This means that it can be called from the page or public code.


On the other hand, .js files are JavaScript modules that bundle your code into logical units. They are executed on the server (if hosted in the backend directory) or on the user’s browser (if hosted in the public directory).


Since .js files are not exposed, they cannot be called from the page or public code if hosted in your backend directory. You can however import modules from the frontend into the backend.


When a request is made to a .jsw file, it has a fixed timeout of 15 seconds. If no value is returned by the RPC within the timeout, the connection with the server is interrupted and the request fails in the frontend code.

However, the execution of the function (in the backend) isn’t stopped and might continue on the backend but won’t be able to return any value to the front end.


The minimum lifespan of a site container (backend server) is 1 minute, so you can expect your code to execute for a full 1 minute and up to 6 minutes (maximum lifespan of the site container).


Now that you understand the differences between .jsw and .js files, you can make an informed decision about which one to use for your Velo project.

24 views0 comments

Recent Posts

See All

留言


Anchor 1

Need help with Velo ?

We provide tutoring and debugging session to all skills levels.

From amateurs to professional developers, help writing high-quality code for performance and security

Maybe later
bottom of page