Skip to content

0.2.0 el Content

Ivan S Glazunov edited this page Feb 20, 2015 · 7 revisions

[new] () => this;

Content > Prototype

  • Provides contents and control methods contents.
  • Not intended for use immediately! Only inheritance!

Instance

var Content = Templates.Content;
var instance = Content();
instance.append('1', function() { return '2'; });
instance.render(console.log); // 12
instance.content(function(callback) { callback('3'); }, '4');
instance.render(console.log); // 34
instance.append('5');
instance.prepend('0');
instance.render(console.log); // 0345

._content

Array<TData>;

Inherited when expanding with .extend.

Contains an array is not formatted TData.

.prepend

(...arguments: Array<TData>) => this;

Add TData in contents flow, before all.

.content

(...arguments: Array<TData>) => this;

Add TData in contents flow, override all.

.append

(...arguments: Array<TData>) => this;

Add TData in contents flow, after all.

._context

IContext;

Context for rendering from this element.

Contexts nested elements are not considered.

.render

(callback: TCallback, context?: IContext) => this;

Method for user use.

Render the element with all contains elements and TData. After rendering the results using in Templates._stringTemplate using the argument context merged with ._context.

._render

(callback: TCallback) => this;

Method for internal use.

Render the element with all contains elements and TData.

Inherits

Clone this wiki locally