ExtensionManager
new ExtensionManager()
The ExtensionManager manages all the extensions available to the viewer.
Register, retrieve, and unregister your extension using the singleton Autodesk.Viewing.theExtensionManager
.
You can load/unload your registered extension into a Viewer by invoking viewer.loadExtension(id, options) and viewer.unloadExtension(id), respectively.
Methods
registerExtension(extensionId, extension)
Registers a new extension with the given id.
Parameters
extensionId* string | The string id of the extension. |
extension* Extension | The Extension-derived class representing the extension. |
Returns
type | description |
---|---|
boolean | True if the extension was successfully registered. |
getExtension(extensionId)
Returns the class representing the extension with the given id.
Parameters
extensionId* string | The string id of the extension. |
Returns
unregisterExtension(extensionId)
Unregisters an existing extension with the given id.
Parameters
extensionId* string | The string id of the extension. |
Returns
type | description |
---|---|
boolean | True if the extension was successfully unregistered. |
registerExternalExtension(extensionId, urlPath)
Registers an extension that needs to be downloaded before using it. The Viewer ships with some extensions that are not bundled, but can be runtime-fetched.
Parameters
extensionId* string | The string id of the extension. |
urlPath* string | The url from where it needs to be pulled from. Can be a relative or an absolute path. |
Returns
type | description |
---|---|
boolean | True if the extension was successfully registered. |
getExternalPath(extensionId)
Returns the url path from where to download the extension; null if not registered through registerExternalExtension().
Parameters
extensionId* string | The string id of the extension. |
Returns
getRegisteredExtensions()
Gets a list of all the extensions that are available for usage. Some are already available in memory, while others may require an additional file to be downloaded prior to its usage.
Returns
type | description |
---|---|
Array.<string> |