Configurator Constructor
Constructor of the configurator object.
Signatures
- Paramate.Configurator(object options)
Details
The function sets up the main configurator object.
Example
configurator = new Paramate.Configurator({
APIHub: 'http://api.paramate.trinckle.com',
APIKey: '64c82bb593e5a2b9af693a603200e57e',
configuratorId: 'd700e591-bf96-4201-be1a-5eceae28afbb',
onAfterConfigure: UpdateConfigurator
});
Throw
- error
-
Throws an error if options.APIKey or options.configuratorId is not defined.
Parameters
- options
-
Object containing parameters for the configurator:
{
APIHub: <string>,
APIKey: <string>,
configuratorId: <string>,
proxy: <string>,
viewPort: <object>,
controls: <object>,
onBeforeConfigure: <function>,
onAfterConfigure: <function>,
onAfterConfigureRedraw: <function>,
onConfigureError: <function>,
undoLevel: <number>,
debug:
{
on: <bool>,
log: <function>,
error: <function>
}
} - options.APIHub
-
(optional) URL of the API Hub. (default: "https://api.paramate.trinckle.com")
- options.APIKey
-
The API Key of the user.
- options.configuratorId
-
The ID of the configurator.
- options.proxy
-
(optional) URL of the proxy request handler for secured requests.
- options.viewPort
-
(optional) The viewport object (see viewport constructor or viewport for WebGL constructor).
- options.controls
-
(optional) The controls object (see constructor for manually generated controls or constructor for auto-controls ).
- options.onBeforeConfigure
-
(optional) Function to be called before configuration starts.
- options.onAfterConfigure
-
(optional) Function to be called after configuration finished.
- options.onAfterConfigureRedraw
-
(optional) Function to be called after a configuration and the subsequent redrawing finished.
- options.onConfigureError
-
(optional) Function to be called if an error occured during configuration.
- options.undoLevel
-
(optional) Number defining how many steps of undo is possible. It is recommended to keep it as low as possible especially for configurators with uploaded files, because of file upload limits and memory consumption in general. (default: 0)
- options.debug
-
(optional) An object defining debugging.
- options.debug.on
-
(optional) Flag to turn debugging on (true) or off (false). (default: true)
- options.debug.log
-
(optional) This function gets called with the result (status, statusText, response) of the HTTP request in case of a successful request or in case of an error. By default this is an empty function that can e.g. replaced with console.log.
- options.debug.error
-
(optional) This function gets called with the result (status, statusText, response) of the HTTP request in case of an error. By default, this is the browser alert function.
Return value
A configurator object.