Skip to content

Latest commit

 

History

History
161 lines (115 loc) · 5.62 KB

API.md

File metadata and controls

161 lines (115 loc) · 5.62 KB

jBlocks : object

Methods to define components using declaration and create new instances. Also helps to find and destroy components.

Kind: global namespace

jBlocks.Component

Kind: static class of jBlocks

new Component(node, name, props)

Param Type
node HTMLElement
name String
props Object

component.name : String

Name of the components used in decl

Kind: instance property of Component

component.node : HTMLElement

Node which component is binded with

Kind: instance property of Component

component.props : Object

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