Skip to content

0.2.3 elements Content

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

Content

[new] () => this;

Content > Prototype

  • Provides contents and control methods contents.
  • Not intended for use immediately! Only inheritance!
  • For end use please use content.

Instance

var Content = Templates.Content;

var instance = Content();
instance.append('1', asSync(function() { return '2'; }));
instance.render(console.log); // 12

instance.content(asAsync(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

(...arguments: Array<TCallback{1}, IContext>) => TAsync(callback: (result: any) => void) => void;;

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.

Returns asynchrony TAsync that lets you embed rendering a stream.

._render

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

Method for internal use.

Render the element with all contains elements and TData.

Clone this wiki locally