-
Notifications
You must be signed in to change notification settings - Fork 0
0.2.7 usage context
Ivan S Glazunov edited this page Feb 20, 2015
·
2 revisions
Context - the object that is passed to a post-processor Templates._stringTemplate.
By default - wrap around method _.template.
Processing occurs automatically when .rendering.
The context may be specified for each element separately using the method Templates.context.
Contexts overlap.
div()(
'<%= c1 %>',
div()('<%= c1 %>'),
div()('<%= c1 %>').context({ c1: 2 }),
div()('<%= c1 %>').context({ c1: 2 }).render({ c1: 3 }),
div()('<%= c1 %>').render({ c1: 4 }),
).render({ c1: 1 }, function(result) {
console.log(result);
});
<div>1<div>1</div><div>2</div><div>3</div><div>4</div></div>
- TData: Renderer|sync|async|Mixin
- TCallback: (error, result) => void
- TSelector: string
- TInjector: () => void
- TAttributes: [name: string]: TData
- TContext: TData
Node.js:
var T = require('oswst');
Require.js:
define(['oswst'], function(T) {});
window
:
var T = window.oswst(_, async);
-
Templates
- .compile
- .include
- .render
- .renderContext
- .renderAttributes
- .renderSelector
- .sync
- .isSyncFunction
- .async
- .isAsyncFunction
- .Prototype()
- .Renderer > .Prototype
- .Data > .Renderer
- .data > .Data
- .Tag > .data
- .Single > .Tag
- .singles[string]
- .Double > .Tag
- .doubles[string]
- .Doctype > .Tag
- .doctypes[string]
- .xml > .Tag
- .Mixin > .Data
- .mixin > .Mixin
- .mixins[string]
- .Module > .Renderer
- .with