Constructor
new MovingVolumeCalculator(target, parametersopt)
Creates an instance of MovingVolumeCalculator
and checks for invalid parameters
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
target |
Element | String | The wrapper for the MovingVolumeCalculator module | |||||||||||||||||||||||||||||||
parameters |
Object |
<optional> |
Additional optional parameters
Properties
|
- Source:
Members
data :Object
The available informations
Type:
- Object
- Source:
surfaceToVolumeRatio :Number
The average surface to volume ratio
Type:
- Number
- Source:
volume :Number
The estimated volume
Type:
- Number
- Source:
Methods
(static) destroy(selector)
Removes any MovingVolumeCalculator mutation from the DOM
Parameters:
Name | Type | Description |
---|---|---|
selector |
String | The MovingVolumeCalculator wrapper selector |
- Source:
(static) fromSurface(surface) → {Number}
Calculates a volume from a surface
Parameters:
Name | Type | Description |
---|---|---|
surface |
Number | The surface to calculate from |
- Source:
Returns:
The 2-decimal rounded volume
- Type
- Number
destroy()
Removes any MovingVolumeCalculator mutation from the DOM
- Source:
isValid() → {Boolean}
Checks if the volume value is valid
- Source:
Returns:
TRUE if the volume input contains a valid value
- Type
- Boolean
offChange() → {MovingVolumeCalculator}
Removes every callback previously added with MovingVolumeCalculator#onChange
- Source:
Returns:
The current MovingVolumeCalculator
offValidate() → {MovingVolumeCalculator}
Removes every callback previously added with MovingVolumeCalculator#onValidate
- Source:
Returns:
The current MovingVolumeCalculator
onChange(callback) → {MovingVolumeCalculator}
Adds a callback to be used when the user changes the volume
Parameters:
Name | Type | Description |
---|---|---|
callback |
onSelectCallback | Function to call after the user's change |
- Source:
Returns:
The current MovingVolumeCalculator
onValidate(callback) → {MovingVolumeCalculator}
Adds a callback to be used when the user validates the volume
Parameters:
Name | Type | Description |
---|---|---|
callback |
onSelectCallback | Function to call after the user's validation |
- Source:
Returns:
The current MovingVolumeCalculator
setLang(lang) → {MovingVolumeCalculator}
Sets the lang
Parameters:
Name | Type | Description |
---|---|---|
lang |
String | The lang to set |
- Source:
Returns:
The current MovingVolumeCalculator
setVolume(volume) → {MovingVolumeCalculator}
Sets the volume
Parameters:
Name | Type | Description |
---|---|---|
volume |
String | The volume to set |
- Source:
Returns:
The current MovingVolumeCalculator
updateData() → {MovingVolumeCalculator}
Updates the data attribute from the current MovingVolumeCalculator
- Source:
Returns:
The current MovingVolumeCalculator
validate(toggleropt) → {MovingVolumeCalculator}
Validates the current volume
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
toggler |
Boolean |
<optional> |
true | TRUE to validate | false to unvalidate |
- Source:
Returns:
The current MovingVolumeCalculator
Type Definitions
Dictionary
Translations object list
Type:
- Object.<String, MovingVolumeCalculator.Lang>
- Source:
Example
{
en: {
roomsOptionEnable: 'I prefer filling out my rooms\' details',
roomsOptionDisable: 'I\'d rather fill out my surface'
},
fr: {
roomsOptionEnable: 'Je préfère renseigner le détail de mes pièces',
roomsOptionDisable: 'Je préfère renseigner ma surface'
}
}
Lang
Translations object
Type:
- Object.<String, String>
- Source:
Example
{
roomsOptionEnable: 'I prefer filling out my rooms\' details',
roomsOptionDisable: 'I\'d rather fill out my surface'
}
Room
Room details
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
icon |
String | URL or HTML of the room's icon |
lang |
Object.<String, String> | Object storing room's translation in mulitple languages |
surface |
Number | The room's average surface |
ratio |
Number | The room's average surface to volume ratio |
- Source:
Example
{
icon: 'https://your.icon',
lang: {
en: 'Kitchen',
fr: 'Cuisine'
},
surface: 14,
ratio: 0.45
}
Rooms
Rooms object list
Type:
- Object.<String, MovingVolumeCalculator.Room>
- Source:
Example
{
kitchen: {
icon: 'https://your.icon',
lang: {
en: 'Kitchen',
fr: 'Cuisine'
},
surface: 14,
ratio: 0.45
}, ...
}