Home Reference Source Test Repository
import IceCap from 'typhonjs-ice-cap/src/IceCap.js'
public class | source

IceCap

IceCap provides programmable HTML templating with cheerio.

Example:

import IceCap from 'typhonjs-ice-cap';

const ice = new IceCap('<p data-ice="name"></p>');
ice.text('name', 'Alice');
console.log(ice.html); // <p data-ice="name">Alice</p>

Static Member Summary

Static Public Members
public static get
public static get
public static get
public static get
public static get
public static get
public static set

debug: *

Static Private Members
private static

_debug: *

Constructor Summary

Public Constructor
public

constructor(html: string, options: {autoClose: boolean, autoDrop: boolean}, eventbus: EventProxy)

Create instance with HTML template.

Member Summary

Public Members
public get
public set
public set
public get
public get

html: *

Private Members
private

_$root: *

private
private

_html: *

private

Method Summary

Public Methods
public

attr(id: *, key: *, value: *, mode: *): *

public

close(): *

public

drop(id: *, isDrop: boolean): *

public

into(id: *, value: *, callback: *): *

public

load(id: *, ice: *, mode: *): *

public

loop(id: *, values: *, callback: *): *

public

text(id: string, value: string, mode: string): IceCap

Apply value to DOM that is specified with id.

Private Methods
private

_filter(nodes: *): *

private

_nodes(id: *): *

private

_takeHTML(): *

Static Public Members

public static get CALLBACK_LOAD: string source

public static get CALLBACK_TEXT: string source

public static get MODE_APPEND: string source

public static get MODE_PREPEND: string source

public static get MODE_REMOVE: string source

public static get MODE_WRITE: string source

public static set debug: * source

Static Private Members

private static _debug: * source

Public Constructors

public constructor(html: string, options: {autoClose: boolean, autoDrop: boolean}, eventbus: EventProxy) source

Create instance with HTML template.

Params:

NameTypeAttributeDescription
html string
  • nullable: false
options {autoClose: boolean, autoDrop: boolean}
eventbus EventProxy

Public Members

public get autoClose: * source

public set autoClose: * source

public set autoDrop: * source

public get autoDrop: * source

public get html: * source

Private Members

private _$root: * source

private _eventbus: * source

private _html: * source

private _options: * source

Public Methods

public attr(id: *, key: *, value: *, mode: *): * source

Params:

NameTypeAttributeDescription
id *
key *
value *
mode *
  • optional

Return:

*

public close(): * source

Return:

*

public drop(id: *, isDrop: boolean): * source

Params:

NameTypeAttributeDescription
id *
isDrop boolean
  • optional
  • default: true

Return:

*

public into(id: *, value: *, callback: *): * source

Params:

NameTypeAttributeDescription
id *
value *
callback *

Return:

*

public load(id: *, ice: *, mode: *): * source

Params:

NameTypeAttributeDescription
id *
ice *
mode *
  • optional

Return:

*

public loop(id: *, values: *, callback: *): * source

Params:

NameTypeAttributeDescription
id *
values *
callback *

Return:

*

public text(id: string, value: string, mode: string): IceCap source

Apply value to DOM that is specified with id.

Params:

NameTypeAttributeDescription
id string
  • nullable: false
value string
mode string
  • optional
  • default: IceCap.MODE_APPEND

Return:

IceCap

self instance.

Private Methods

private _filter(nodes: *): * source

Params:

NameTypeAttributeDescription
nodes *

Return:

*

private _nodes(id: *): * source

Params:

NameTypeAttributeDescription
id *

Return:

*

private _takeHTML(): * source

Return:

*