Skip to content

0.1.0 proto Prototype

Ivan S Glazunov edited this page Jan 22, 2015 · 1 revision

new () => instance: Prototype

Main prototype, fix need for new.

._parent

Prototype

Set at inheritance.

._data

data[]

Set at construct.

._context

context[]

Set at construct.

.context

(...context) => this

Set _context in flow.

._arguments

any[]

Set at construct.

.extend

(injector?: (parent: Prototype).call(instance: Prototype) => void) => instanceof Prototype

injector

(parent: Prototype).call(instance: Prototype) => void

Pass on construct.

.returner

().call(instance: Prototype) => any

Set at inheritance.

.constructor

(...arguments: any[]).call(instance: Prototype) => any

Set at inheritance.

._render

(callback: (result: string) => void) => this

Uses internal methods for rendering. Ignore context.

.render

(callback: (result: string) => void, ...context) => this

After rendering - handle result with _.template and context.

var div = Templates.double.div, h1 = Templates.double.h1;

div('.class[alt="<%= name %>"]')(
	h1()('<%= title %>')
).render(function(result) {
	console.log(result);
}, { title: 'Example', name: 'semple' });
<div class="class" alt="semple"><h1>Example</h1></div>
Clone this wiki locally