- MVC
- class EventTarget
- class Component
- class Section
- class Page
- Custom elements
- define
- class CustomHTMLElement
- API
- Router
- Route
- Configuration
- init
- initAll
- Amonite
Create an object that can trigger functions when events happens. The object can listen, dispatch and stop to listen events.
Parameter: none
Returns: {EventTarget}
new instance.
Start to listen event eventName
and trigger fn
when event happens.
Parameters:
{array.[{string}...]|String} eventName
The event name or list of event names listened ;{array[{function}...]|function} fn
The function or list of functions executed when event happens.
Returns: {EventTarget}
self instance.
Trigger event eventName
, with optional list of arguments args
sent in the functions.
Parameters:
{array.[{string}...]|String} eventName
The event to trigger ;{array[*]|null} args
The optional & additional parameters.
Returns: {EventTarget}
self instance.
Stop listening at event eventName
for function fn
, or for all function if fn
is not filled.
Parameters:
{array.[{string}...]|String} eventName
The event to stop to listen at ;{array[{function}...]|function|*} fn
The targeted function. If not filled, stop every functions of eventeventName
.
Returns: {EventTarget}
self instance.
Listen event eventName
for once and trigger fn
when happens.
Parameters:
{array.[{string}...]|String} eventName
The event to listen one time ;{array[{function}...]|function} fn
The function executed when event happens.
Returns: {EventTarget}
self instance.
Extends: EventTarget
Create an object for handling an HTMLElement and its DOM. A component generate the HTMLElement, manage its children elements and their events. A component can be inserted in another component.
Parameters: ...{*} arguments
a list of arguments sent in template
, elements
, events
and container
at component constructing.
Returns: {Component}
new instance.
The value returned by function container
after component construction. It should be an HTMLElement. The container should wrap the component in browser document DOM.
Type: {HTMLElement|null}
The value returned by function template
after component construction. It should be an HTMLElement. This is the DOM managed by this component.
Type: {HTMLElement|null}
The value returned by function elements
after component construction. It should be an object where each field is an element name associated to a list of matching HTMLElement. The elements are in the template context at load (before editing the DOM).
Type: {Object.<{array.[...{HTMLElement}]} elementName>}
The value returned by function events
after component construction. It should be a nested object where itself and children objects are targeting event names, select DOM elements and register functions.
Type: {object}
- Example 1 :
{"div#login @click": "onClick"}
- Example 2 :
{"@click div#login": "onClick"}
- Example 3 :
{"div#login": {"@click": "onClick"}}
- Example 4 :
{"@click": {"div#login": "onClick"}}
- Example 5 :
{"div#login p,element1 @click,dblclick": "prepareClick,onClick"}
- Example 6 :
{"div#login p": {"@click": ["prepareClick", {"element1 @dblclick": "onClick"}]}}
The sixth example will do:
- For matching element
"div#login p"
on"click"
, do"prepareClick"
function of component ; - For matching element
"div#login p"
and"element1"
on"click"
or"dblclick"
, do"onClick"
function of component.
Extends: Component
Display this section in its Page
returned by section.wrapper
Parameter: none
Returns: {Section}
self instance
Extends: Component
Display section section
in this instance of Page
. Do not force displaying this instance in the application body.
Parameter:
{Section} section
the section displayed
Returns: {Page}
self instance
Display this Page
instance with section
section.
Parameter:
{Section} section
the section displayed
Returns: {Page}
self instance