Skip to content

0.2.7 interfaces IContext

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

IContext

interface IContext { [name: string]: TData; };

Describes the interface to the execution context rendering.

Examples

var context = {
	type: 'name',
	data: asAsync(function(callback) { callback('Example'); }),
	person: {
		age: function() { return 100; },
		whose: asSync(function() { return 'my'; })
	}
};
Templates._stringTemplate('<%= person.whose %> <%= type %>: <%= name %>, age: <%= person.age() %>', context, console.log);
// my name: Example, age: 100
Clone this wiki locally