Methods to define components using declaration and create new instances. Also helps to find and destroy components.
Kind: global namespace
- jBlocks :
object
- .Component
- new Component(node, name, props)
- instance
- static
- .destroy(node) ⇒
jBlocks
- .forget(name) ⇒
jBlocks
- .get(node) ⇒
Component
- .Component
Kind: static class of jBlocks
- .Component
- new Component(node, name, props)
- instance
- static
Param | Type |
---|---|
node | HTMLElement |
name | String |
props | Object |
Name of the components used in decl
Kind: instance property of Component
Node which component is binded with
Kind: instance property of Component
Props of the component gained from data-props
Kind: instance property of Component
Component.on(event, callback) ⇒ Component
Attach an event handler function for the given event
Kind: static method of Component
Param | Type |
---|---|
event | String |
callback | function |
Component.off(event, callback) ⇒ Component
Remove an event handler function for the given event
Kind: static method of Component
Param | Type |
---|---|
event | String |
callback | function |
Component.emit(event, data) ⇒ Component
Execute all handlers attached for the given event
Kind: static method of Component
Param | Type |
---|---|
event | String |
data | * |
Component.once(event, callback) ⇒ Component
Attach an event handler function for the given event which will be called only once
Kind: static method of Component
Param | Type |
---|---|
event | String |
callback | function |
Component.destroy() ⇒ Component
Destroy the instance
Kind: static method of Component
jBlocks.destroy(node) ⇒ jBlocks
Destroy instance binded to the node
Kind: static method of jBlocks
Param | Type |
---|---|
node | HTMLElement |
jBlocks.forget(name) ⇒ jBlocks
Remove declaration from cache
Kind: static method of jBlocks
Param | Type | Description |
---|---|---|
name | String |
name of component |
jBlocks.get(node) ⇒ Component
Create and return a new instance of component
Kind: static method of jBlocks
Returns: Component
- a new instance
Param | Type |
---|---|
node | HTMLElement |