Constructor
new Jaw(jawId)
Parameters:
| Name | Type | Description |
|---|---|---|
jawId |
string | The id that would identify this Jaw. |
Properties:
| Name | Type | Description |
|---|---|---|
route |
string | If the routingMethod is setted to "url", this will be the url that will be displayed |
Methods
(static) __getNodeDepth(elements)
Add multiple data to be rendered by TemplateRenderer object and just after adding the data it render the current page.
Parameters:
| Name | Type | Description |
|---|---|---|
elements |
object | array | This could be an Array of objects with name and value properties or an object with several properties. In the latter case each property will be copied "as is" in the data to be rendered. |
- Deprecated:
- - This method has been definitively replaced by the
set method.
- - This method has been definitively replaced by the
- Source:
addComponent(component) → {object}
Add a Component to this Jaw. The added Component will be used to render and manage sub-parts of the view.
Parameters:
| Name | Type | Description |
|---|---|---|
component |
object | The Component to add as a string or Component object reference. |
Returns:
The complete list of active Components.
- Type
- object
addComponents(components) → {object}
Add an array of Component to this Jaw. The added Components will be used to render and manage sub-parts of the view.
Parameters:
| Name | Type | Description |
|---|---|---|
components |
array | The list of Components to add as a string or Component object reference. |
Returns:
The complete list of active Components.
- Type
- object
addMethod(methodName, methodBody, optionsopt) → {object|array|number|null}
Add a method to this Jaw. The added method will be available using the standard object.method() syntax.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
methodName |
string | The name of the new method. It will be the name used to call this method. | ||||||||||||||||
methodBody |
function | The function that will be executed when the method will be called. | ||||||||||||||||
options |
object |
<optional> |
An object containing the options.
Properties
|
- Version:
- 1.0.2, 2017.07.26
- Deprecated:
- - This method should not be used and should be replaced by using Class methods.
- Source:
Returns:
- Type
- object | array | number | null
emit(eventName, eventDataopt)
Makes this Jaw dispatch an event and, optionally, send data with it.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
eventName |
string | The name of the event that will be dispatched. | |
eventData |
object |
<optional> |
The optional data that will be deliverd to the event listener. |
init()
A method called when a Jaw is used for the first time. Should be overrided.
off(eventName, eventHandler)
Permit to unbind a function as handler for an event dispatched by this Jaw.
Parameters:
| Name | Type | Description |
|---|---|---|
eventName |
string | The name of the event that the handler will be removed from. |
eventHandler |
function | The function that will be removed as event handler. |
on(eventName, eventHandler)
Permit to bind a function as handler for an event dispatched by this Jaw.
Parameters:
| Name | Type | Description |
|---|---|---|
eventName |
string | The name of the event that the handler will be bound to. |
eventHandler |
function | The function that will handle the event when dispatched. |
set(nameOrItems, value, options, requireRender)
Add data to this Jaw internal data store. This data will automatically passed to renderer, so any value saved with this metod will be rendered if its name is printed in html template.
Parameters:
| Name | Type | Description |
|---|---|---|
nameOrItems |
string | object | array | The name of the object that will contain data. If an empty string is passed, the data as merged into the root data object, usefull to add data that doesn't need to be nested. If an object is passed then every property of the object is cloned into the Jaw internal store. If an array of objects with name and value propeties is passed, then each item in the array will be added to the internal store. |
value |
any | The value to store. Used only if the nameOrItems parameter is a string. |
options |
object | Unused. |
requireRender |
boolean | Unused. |
smartListen(containeropt)
This is an internal method, not meant to be used by the user.
One of the Shark core feature: automatically match jaw's methods based on this naming convention: selector_eventnameHandler.
It both works whit class and id CSS selector.
It also assign listeners using name from registered controllers if a function named controllername_eventnameHandler exists.
You should call this manually when you know your markup is rendered.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
container |
string | jQuerySelection |
<optional> |
If a CSS selector or a DOM element selected with jQuery is passed, the smartListen function will parse only that element and its childs. Useful if you just need to parse a freshly-rendered container. |
smartListen2(optionsopt)
This method renders current view on the screen.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
object |
<optional> |
An object that may contains options regarding the render of this view. It will be joined with the currentOpenOptions property. |
- Version:
- 1.0.0.0
- Deprecated:
- - This method will be definitively replaced by the
Shark.render() method. Single Jaw must not try to render itself.
- - This method will be definitively replaced by the
- Source:
smartUnlisten(containeropt)
One of the Shark core feature: automatically remove listener added by the
It works with both DOM and controller assignment.
smartListen method.
It works with both DOM and controller assignment.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
container |
string | jQuerySelection |
<optional> |
If a CSS selector or a DOM element selected with jQuery is passed, the smartUnlisten function will parse only that element and its childs. Useful if you just need to parse a freshly-rendered container. |