Core
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 no access token or authentication callback is provided, the Initializer will fall back on an access token provided in the URL query string, or a previous access token stored in the cookie cache, if available. The static function Autodesk.Viewing.createInitializerOption s() can be used to create an object with all the supported attributes. |
env string | Can be “Development”, “Staging” or “Production”, for viewers running without PAAS endpoints. Can be “AutodeskDevelopment”, “AutodeskStaging”, or “AutodeskProduction” for viewers running with PAAS endpoints. |
getAccessToken function | An function that provides an access
token asynchronously. The function
signature is
getAccessToken(onSuccess) , where
onSuccess is a callback that
getAccessToken function should invoke
when a token is granted, with the token
being the first input parameter for the
onSuccess function, and the token expire
time (in seconds) being the second input
parameter for the function. Viewer
relies on both getAccessToken and the
expire time to automatically renew
token, so it is critical that
getAccessToken must be implemented as
described here. |
useADP boolean | Whether to report analytics to ADP. True by default. |
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