modapp-resource-component

1.8.3 • Public • Published

view on npm

ModApp Resource Component

Collection of resource components following the component interface of modapp.

Installation

With npm:

npm install modapp-resource-component

With yarn:

yarn add modapp-resource-component

Usage

Import any selected component and use it.

import { ModelTxt } from 'modapp-resource-component';

let txt = new ModelTxt({ foo: "Hello World!" }, m => m.foo);
txt.render(document.body);

All components follows modapp's component interface:

Component Interface

A UI component

Kind: global interface

component.render(el) ⇒ HTMLElement | DocumentFragment | null

Renders the component by appending its own element(s) to the provided parent element.
The provided element is not required to be empty, and may therefor contain other child elements.
The component is not required to append any element in case it has nothing to render.
Render is never called two times in succession without a call to unrender in between.

Kind: instance method of Component
Returns: HTMLElement | DocumentFragment | null - Element or document fragment appended to el. May be null or undefined if no elements was appended.

Param Type Description
el HTMLElement | DocumentFragment Parent element in which to render the contents

component.unrender()

Unrenders the component and removes its element(s) from the parent element.
Only called after render and never called two times in succession without a call to render in between.

Kind: instance method of Component

/modapp-resource-component/

    Package Sidebar

    Install

    npm i modapp-resource-component

    Weekly Downloads

    6

    Version

    1.8.3

    License

    MIT

    Unpacked Size

    535 kB

    Total Files

    54

    Last publish

    Collaborators

    • jirenius