medom
v0.3.1
Published
Just a wrapper of HTML elements
Downloads
4
Maintainers
Readme
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
- Component
- new Component(tpl, [cfg])
- instance
- .getWidget(widget) ⇒ Component | undefined
- .get(query) ⇒ Component | undefined
- .getAll(query) ⇒ array
- .isVisible() ⇒ boolean
- .hide([opt]) ⇒ Component
- .show([opt]) ⇒ Component
- .setState(state) ⇒ Component
- .getState() ⇒ *
- .setContent(content) ⇒ Component
- .getContent() ⇒ HTMLElement
- .append(...cmp) ⇒ Component
- .renderTo(target, [opt]) ⇒ Component
- .on(eventName, callback) ⇒ Component
- .suspendEvent(...eventName) ⇒ Component
- .resumeEvent(...eventName) ⇒ Component
- .suspendEvents() ⇒ Component
- .resumeEvents() ⇒ Component
- static
- .isComponent(cmp) ⇒ boolean
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