0.3.1 • Published 6 years ago

medom v0.3.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Medom

Just a wrapper of HTML elements.

Installation

npm install --save medom

Example

const {Component} = require('medom');

const myComponent = new Component('<app-my-component></app-my-component>');

myComponent
    .setContent('Hello World')
    .renderTo(document.body);

API

Classes

Component

Kind: global class

new Component(tpl, cfg)

Create instance

component.getWidget(widget) ⇒ Component | undefined

Get component by widget name

Kind: instance method of Component

component.get(query) ⇒ Component | undefined

Get component by query

Kind: instance method of Component

component.getAll(query) ⇒ array

Get all components by query

Kind: instance method of Component

component.isVisible() ⇒ boolean

Check if component is visibile

Kind: instance method of Component

component.hide(opt) ⇒ Component

Hide component

Kind: instance method of Component
Emits: Component#event:hide

component.show(opt) ⇒ Component

Show component

Kind: instance method of Component
Emits: Component#event:show

component.setState(state) ⇒ Component

Set state

Kind: instance method of Component
Emits: Component#event:state, Component#event:beforeState

component.getState() ⇒ *

Get current state

Kind: instance method of Component

component.setContent(content) ⇒ Component

Update content

Kind: instance method of Component
Emits: Component#event:beforeContentChange, Component#event:contentChange

component.getContent() ⇒ HTMLElement

Get content

Kind: instance method of Component

component.append(...cmp) ⇒ Component

Append other Medom components

Kind: instance method of Component
Emits: Component#event:contentChange

component.renderTo(target, opt) ⇒ Component

Render component to target

Kind: instance method of Component

component.on(eventName, callback) ⇒ Component

Adds listener to instance

Kind: instance method of Component

component.suspendEvent(...eventName) ⇒ Component

Suspends firing of the named event(s), works only with native component event.

Kind: instance method of Component

component.resumeEvent(...eventName) ⇒ Component

Resumes firing of the named event(s), works only with native component event.

Kind: instance method of Component

component.suspendEvents() ⇒ Component

Suspends all events, works only with native component event.

Kind: instance method of Component

component.resumeEvents() ⇒ Component

Resume all events, works only with native component event.

Kind: instance method of Component

Component.isComponent(cmp) ⇒ boolean

Check if is a Medom component

Kind: static method of Component

DOM

Kind: global class

DOM.get(element) ⇒ *

Get Medome component by Element

Kind: static method of DOM

DOM.getByQuery(query, ctx) ⇒ *

Get Medom component by query

Kind: static method of DOM

DOM.getByQueryAll(query, ctx) ⇒ *

Get Medom components by query

Kind: static method of DOM

License

medom is open-sourced software licensed under the MIT license

Author

Fabio Ricali

0.3.1

6 years ago

0.3.0

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago