env( )


Gets the current environment the rendering process is running in.

When possible, the rendering process is split in two in order to improve performance. The first cycle in the process happens in the server-side code and the second cycle happens in the client-side code. If not possible on the server-side, all rendering happens client-side.

The env property returns "backend" when rendering on the server and "browser" when rendering on the client.

Use the env property in the page's onReady() event handler to control where your code runs during the rendering process and to prevent code that causes side effects from running twice.

Note: Rendering never occurs server-side when previewing a site.

Method Declaration
Copy
Request
This method does not take any parameters
Returns
Return Type:Promise<string>
Did this help?