• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API

    Show / Hide Table of Contents

    Interface SxcGlobal

    This is the root global window.$2sxc function / object. It is both a function window.$2sxc(...) and object window.$2sxc.insights...

    If the page feature 2sxc.JsCms is enabled, the window.$2sxc will also be a SxcGlobalWithCms

    you are here (click to zoom) - discover the stack

    Main Function $2sxc(...)

    This is a object/function hybrid. So it is usually used like this:

    var sxc = window.$2sxc(moduleId);
    

    The signature /parameters is the same as the $2sxc.get(...) function.

    The resulting object is a Sxc

    History

    1. Introduced in 2sxc 04.00
    2. Enhanced with cms (see cms) in 9.30
    3. Enhanced the $2sxc(...) constructor with the ContextIdentifier in v11.11
    Package: Api.Js.SxcJs

    Properties

    env

    Environment information

    Declaration
    env: SxcGlobalEnvironment
    Property Value
    Type Description
    SxcGlobalEnvironment

    http

    Http helper for API calls and such

    Declaration
    http: SxcGlobalHttp
    Property Value
    Type Description
    SxcGlobalHttp

    sysinfo

    system information, mainly for checking which version of 2sxc is running note: it's not always updated reliably, but it helps when debugging

    Declaration
    sysinfo: Object
    Property Value
    Type Description
    Object

    urlParams

    Helper to work with url parameters behind ? or #

    Declaration
    urlParams: UrlParams
    Property Value
    Type Description
    UrlParams

    Methods

    get(ContextIdentifier)

    Get an Sxc Instance using a full context-identifier (advanced). Using $2sxc.get(...) is the same as using $2sxc(...)

    Declaration
    function get(context: ContextIdentifier)
    Parameters
    Type Name Description
    ContextIdentifier context

    ContextIdentifier: full context identifier

    Returns
    Type Description
    Sxc

    Sxc

    get(HTMLElement)

    Get an Sxc Instance using a tag / HtmlElement. Using $2sxc.get(...) is the same as using $2sxc(...)

    Declaration
    function get(tag: HTMLElement)
    Parameters
    Type Name Description
    HTMLElement tag

    HTMLElement: tag in the page

    Returns
    Type Description
    Sxc

    Sxc

    get(number)

    Get an Sxc Instance using the moduleId. Using $2sxc.get(...) is the same as using $2sxc(...)

    Declaration
    function get(moduleId: number)
    Parameters
    Type Name Description
    number moduleId

    number: moduleId

    Returns
    Type Description
    Sxc

    SxcInstance

    get(number, number)

    Get an Sxc Instance using the moduleId and contentBlockId. Using $2sxc.get(...) is the same as using $2sxc(...)

    Declaration
    function get(moduleId: number, contentBlockId: number)
    Parameters
    Type Name Description
    number moduleId

    number: moduleId

    number contentBlockId

    number: content-block ID

    Returns
    Type Description
    Sxc

    Sxc

    get(Sxc)

    Get an Sxc Instance passing in an existing Sxc - just for cases where you're not sure what you aready have. Using $2sxc.get(...) is the same as using $2sxc(...)

    Declaration
    function get(sxc: Sxc)
    Parameters
    Type Name Description
    Sxc sxc

    Sxc: an existing sxc - will just be returned

    Returns
    Type Description
    Sxc

    Sxc - the same Sxc as the one which was passed in

    insights(string, number, number, number)

    The debugging / insights system. Call the $2sxc.insights() without parameters to get instructions what the parameters could be.

    Declaration
    function insights(partName: string, index?: number, start?: number, length?: number)
    Parameters
    Type Name Description
    string partName

    optional name of a part of the system for which we want to see the logs

    number index

    optional index on that part for which log we want to see

    number start

    log start index - this is to skip the first few lines if there are too many

    number length

    amount of lines to show - in some cases will default to 25

    • Improve this Doc
    Back to top Generated by DocFX