Skip to content

AxelBilla/Kompacted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

KOMPACTED_LOGO_FULL

Kompacted - Simple Component Manager


Kompacted is a library meant to facilitate the production of web applications
using JavaScript by implementing client-side components.


GitHub release License issues - Kompacted



Documentation


Basics

? = Optional

new Kompacted(?saved, ?name) : Kompacted

(boolean)     [saved]: Whether this instance should be saved statically (accessible via Kompacted.getKompacted()) or not.
(string)      [name]: Identifier of this instance.

Creation of a Kompacted instance to work with (may or may not be accessible statically)


Kompacted.new(templates, ?scope, ?deep) : void

(func)        [templates]: Collection of Kompacted.add() wrapped in a function.
(HTMLElement) [scope]: Element from which to start a Kompacted.load().
(boolean)     [depth]: Whether Komps should be children of their Kompact/Foreach or replace them.

Wrapper to harmonize the creation of Komps (template), automatically loads Komps if given a scope.


Kompacted.add(name, html, ?type, ?func) : Kompacted.template

(string)      [name]: Identifier of the Komp (template), to be referenced in the "as" attribute of Kompact/Foreach tags.
(string)      [html]: HTML content of the Komp (template).
(string)      [type]: Type of event the Komp will listen to upon being loaded.
(func)        [func]: Function to execute when the Komp's listened event is triggered.

Creates a Komp template and registers it in its instance of Kompacted's template list.


Kompacted.edit(name, html, ?type, ?func) : void

(string)      [name]: Identifier of the Komp (template) to be edited.
(string)      [html]: HTML content of the Komp (template).
(string)      [type]: Type of event the Komp will listen to upon being loaded.
(func)        [func]: Function to execute when the Komp's listened event is triggered.

Edits an already existing Komp template (runtime).


Kompacted.set(id, data_array) : void

(key)         [id]: Identifier of the data.
(object)      [data_array]: JSON/Array object accessible in Kompact/Foreach tags via its ID.

Sets a set of data to a given identifier, to be referenced in the "src" attribute of Kompact/Foreach tags.


Kompacted.load(?scope, ?depth) : void

(HTMLElement) [scope]: Element from which to start loading Komps recursively from (defaults to document).
(boolean)     [depth]: Whether Komps should be children of their Kompact/Foreach or replace them.

Loads all Komps of its Kompacted instance.


[STATIC] Kompacted.load(scope, depth, kompacted) : void

(HTMLElement) [scope]: Element from which to start loading Komps recursively from.
(boolean)     [depth]: Whether Komps should be children of their Kompact/Foreach or replace them.
(object)      [kompacted]: List of Kompacted instances to load Komps from.

Allows users to load Komps from different instances of Kompacted at once.





Advanced

w.I.P.