Namespace slikcalc
slikcalc
Defined in: slikcalc.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
slikcalc.adapter
Reference to 3rd party library slikcalc adapter
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
slikcalc.addListener(elementId, type, method, scope)
Adds an event listener to the element passed in.
|
| <static> |
slikcalc.addOnLoad(method, scope)
Attaches an event to the onLoad event of the page
|
| <static> |
slikcalc.bindEvent(event, method, scope)
Binds the provided callback to the custom event passed in.
|
| <static> |
slikcalc.create(type, config)
Factory method for creating calculator objects
|
| <static> |
slikcalc.createCustomEvent(eventType)
Creates a custom event through delegating to the 3rd party library adapter.
|
| <static> |
slikcalc.extend(subc, superc)
Utility method for class extension.
|
| <static> |
slikcalc.fireEvent(event)
Triggers the custom event passed in
|
| <static> |
slikcalc.formatCurrency(num)
returns a Float of two decimal places from the provided String/Number.
|
| <static> |
slikcalc.get(id)
Retrieves an HTML Element by delegating to the adapter library.
|
| <static> |
slikcalc.getAmount(Element)
Returns an elements value or innerHTML as a float formatted as currency
|
| <static> |
slikcalc.getValue(el)
Gets the elements value.
|
| <static> |
slikcalc.isInput(element)
Determines if the element passed in is an HTML input
|
| <static> |
slikcalc.setAmount(el, value)
Sets elements value or innerHTML depending on element type formatted as currency
|
| <static> |
slikcalc.setValue(el, value)
Sets elements value or innerHTML depending on element type
|
| <static> |
slikcalc.trim(string)
Removes whitespace from the head/tail of a string
|
| <static> |
slikcalc.validateAdapter()
Ensures that the slikcalc 3rd party library adapter has been set.
|
Field Detail
<static>
slikcalc.adapter
Reference to 3rd party library slikcalc adapter
Method Detail
<static>
slikcalc.addListener(elementId, type, method, scope)
Adds an event listener to the element passed in.
- Parameters:
- {String/HTMLElement} elementId
- Element to attach event to
- {String} type
- String representation of the type of event to attach to
- {Function} method
- Reference to a callback method to fire when the event fires
- {Object} scope
- (Optional) Scope object to use when executing the callback if required
<static>
slikcalc.addOnLoad(method, scope)
Attaches an event to the onLoad event of the page
- Parameters:
- {Function} method
- Reference to a callback method to fire when the onLoad event fires
- {Object} scope
- (Optional) Scope object to use when executing the callback if required
<static>
slikcalc.bindEvent(event, method, scope)
Binds the provided callback to the custom event passed in. This delegates to the 3rd party library adapter
- Parameters:
- {Object} event
- Reference to slikcalc custom event
- {Object} method
- Callback method to bind to the custom event
- {Object} scope
- (Optional) Scope object to use when executing the callback if required
<static>
{slikcalc.BaseCalc}
slikcalc.create(type, config)
Factory method for creating calculator objects
- Parameters:
- {String} type
- String representing the type of calculator to create. Either 'column' or 'formula'.
- {Object} config
- config object for calculator being created, see calculators constructor for options.
- Returns:
- {slikcalc.BaseCalc} Returns the concrete type of slikcalc.BaseCalc specified
<static>
{Object}
slikcalc.createCustomEvent(eventType)
Creates a custom event through delegating to the 3rd party library adapter.
This custom event is used internally for slikcalc custom events.
- Parameters:
- {String} eventType
- String identifier for custom event type
- Returns:
- {Object} Custom event object for internal slikcalc use
<static>
slikcalc.extend(subc, superc)
Utility method for class extension. Copies the prototype of the superclass onto the subclass
- Parameters:
- {Object} subc
- Subclass
- {Object} superc
- Superclass
<static>
slikcalc.fireEvent(event)
Triggers the custom event passed in
- Parameters:
- {Object} event
- Reference to slikcalc custom event to fire
<static>
{Float}
slikcalc.formatCurrency(num)
returns a Float of two decimal places from the provided String/Number.
Returns 0.00 if no number or an improperly formatted String is passed in
- Parameters:
- {String/Number} num
- Returns:
- {Float} Float value of set to two decimal places.
<static>
slikcalc.get(id)
Retrieves an HTML Element by delegating to the adapter library.
- Parameters:
- {String/HTMLElement} id
<static>
{Float}
slikcalc.getAmount(Element)
Returns an elements value or innerHTML as a float formatted as currency
- Parameters:
- {String/HTMLElement} Element
- ID or reference
- Returns:
- {Float} Float value of element, formatted as currency
<static>
{String}
slikcalc.getValue(el)
Gets the elements value. This handles getting actual input values,
or inner text of an element, depending on the type of element
- Parameters:
- {String/HTMLElement} el
- Element id or reference
- Returns:
- {String} Elements value or innerHTML
<static>
{Boolean}
slikcalc.isInput(element)
Determines if the element passed in is an HTML input
- Parameters:
- {String/HTMLElement} element
- Returns:
- {Boolean} true/false if the element is an HTML input
<static>
slikcalc.setAmount(el, value)
Sets elements value or innerHTML depending on element type formatted as currency
- Parameters:
- {String/HTMLElement} el
- Element ID or reference to set
- {String/Number} value
- Amount to set, can be a string or number
<static>
slikcalc.setValue(el, value)
Sets elements value or innerHTML depending on element type
- Parameters:
- {String/HTMLElement} el
- Element ID or reference
- {String} value
- Value to set for the element passed in
<static>
{String}
slikcalc.trim(string)
Removes whitespace from the head/tail of a string
- Parameters:
- {String} string
- Returns:
- {String}
<static>
slikcalc.validateAdapter()
Ensures that the slikcalc 3rd party library adapter has been set.