Class SxcGlobalEnvironment
Provides environment information to $2sxc - usually page-id, api-root and stuff like that
The $2sxc.env API
The $2sxc.env object manages environment information for the JavaScript.
Tip
In most cases you won't use this, but instead get the Sxc object for the current instance and use either the data, query or webApi service.
History
- Introduced in 2sxc 10.25
Package: Api.Js.SxcJs
Properties
ready
Flag to determine if the environment information is available.
The $2sxc.env API
The $2sxc.env object manages environment information for the JavaScript.
Tip
In most cases you won't use this, but instead get the Sxc object for the current instance and use either the data, query or webApi service.
History
- Introduced in 2sxc 10.25
Declaration
ready: boolean
Property Value
| Type | Description |
|---|---|
| boolean |
source
Where the environment information came from.
The $2sxc.env API
The $2sxc.env object manages environment information for the JavaScript.
Tip
In most cases you won't use this, but instead get the Sxc object for the current instance and use either the data, query or webApi service.
History
- Introduced in 2sxc 10.25
Declaration
source: string
Property Value
| Type | Description |
|---|---|
| string |
Methods
api()
The API endpoint url from the environment
The $2sxc.env API
The $2sxc.env object manages environment information for the JavaScript.
Tip
In most cases you won't use this, but instead get the Sxc object for the current instance and use either the data, query or webApi service.
History
- Introduced in 2sxc 10.25
Declaration
function api()
Returns
| Type | Description |
|---|---|
| string |
load(EnvironmentSpecs, string)
Manually load a new EnvironmentSpecs in cases where the page cannot provide them. This is only used in scenarios outside of Dnn / Oqtane, you will usually not need this.
The $2sxc.env API
The $2sxc.env object manages environment information for the JavaScript.
Tip
In most cases you won't use this, but instead get the Sxc object for the current instance and use either the data, query or webApi service.
History
- Introduced in 2sxc 10.25
Declaration
function load(envSpecs: EnvironmentSpecs, source?: string)
Parameters
| Type | Name | Description |
|---|---|---|
| EnvironmentSpecs | envSpecs |
new info to load |
| string | source |
optional name where the data came from |
page()
The current page ID - often needed in API calls
The $2sxc.env API
The $2sxc.env object manages environment information for the JavaScript.
Tip
In most cases you won't use this, but instead get the Sxc object for the current instance and use either the data, query or webApi service.
History
- Introduced in 2sxc 10.25
Declaration
function page()
Returns
| Type | Description |
|---|---|
| number |
platform()
The platform code like 'oqt' or 'dnn' in case the JS needs to know the difference
The $2sxc.env API
The $2sxc.env object manages environment information for the JavaScript.
Tip
In most cases you won't use this, but instead get the Sxc object for the current instance and use either the data, query or webApi service.
History
- Introduced in 2sxc 10.25
Declaration
function platform()
Returns
| Type | Description |
|---|---|
| string |
rvt()
The request-verification token for internal WebAPI calls
The $2sxc.env API
The $2sxc.env object manages environment information for the JavaScript.
Tip
In most cases you won't use this, but instead get the Sxc object for the current instance and use either the data, query or webApi service.
History
- Introduced in 2sxc 10.25
Declaration
function rvt()
Returns
| Type | Description |
|---|---|
| string |
rvtHeader()
The request verification token header name for internal WebAPI calls
The $2sxc.env API
The $2sxc.env object manages environment information for the JavaScript.
Tip
In most cases you won't use this, but instead get the Sxc object for the current instance and use either the data, query or webApi service.
History
- Introduced in 2sxc 10.25
Declaration
function rvtHeader()
Returns
| Type | Description |
|---|---|
| string |