Request

Response

    Autodesk.Viewing

    Initializer

    new Initializer(options, callback)

    Helper class for initializing the viewer runtime.

    Includes:

    End points of cloud services the viewer uses, like viewing service and search service. Authentication and authorization cookie settings on the client side. Misc runtime environment variables and viewer configurations parameters.

    Parameters

    Expand all
    options*
    object
    The options object contains configuration parameters used to do initializations. If noaccess token or authentication callback is provided, the Initializer will fall backon an access token provided in the URL query string, or a previous access token stored inthe cookie cache, if available. The static function Autodesk.Viewing.createInitializerOptions() can be used to createan object with all the supported attributes.
    env
    string
    Can be "Development", "Staging" or "Production", for viewers running without PAASendpoints. Can be "AutodeskDevelopment", "AutodeskStaging", or "AutodeskProduction"for viewers running with PAAS endpoints.
    api
    string
    Can be undefined (default),use "modelDerivativeV2" or "derivativeV2" for US data center,or use "derivativeV2_EU" for European data center.
    getAccessToken
    function
    An function that provides an access token asynchronously.The function signature is getAccessToken(onSuccess), where onSuccess is a callback that getAccessTokenfunction should invoke when a token is granted, with the token being the first input parameter for theonSuccess function, and the token expire time (in seconds) being the second input parameter for thefunction. Viewer relies on both getAccessToken and the expire time to automatically renew token, soit is critical that getAccessToken must be implemented as described here.
    accessToken
    string
    An access token.
    webGLHelpLink
    string
    A link to a help page on webGL if it’s disabled.
    language
    string
    Preferred language code as defined in RFC 4646, such as "en", "de", "fr", etc.If no language is set, viewer will pick it up from the browser. If language is not as defined in RFC,viewer will fall back to "en" but the behavior is undefined.
    callback*
    function
    A method the client executes when initialization is finished.
    * Required

    Examples

     var options = {
       env: "AutodeskProduction",
       language: "en",
       webGLHelpLink: "http://my.webgl.help.link",
       getAccessToken: function(onSuccess) {
           var accessToken, expire;
           // Code to retrieve and assign token value to
           // accessToken and expire time in seconds.
           onSuccess(accessToken, expire);
       }
    };
    var callback = function() {
       alert("initialization complete");
    };
    Autodesk.Viewing.Initializer(options, callback);
    
    Show More