-
Notifications
You must be signed in to change notification settings - Fork 0
0.2.7 usage mixin
ivansglazunov edited this page Feb 1, 2015
·
2 revisions
Templates.mixin(reconstructor: (...arguments: IArguments) => any) => Content
Mixin have to return something, otherwise it will be considered empty.
var mixin = Templates.mixin;
var mix = mixin(function(a, b, c) {
return div({ a: a })(b, div()(c));
});
mix(1,2,3).render(console.log);
<div a="1">2<div>3</div></div>
In coffeeScript looks even better.
mixin = Templates.mixin
mix = mixin (a, b, c) -> div(a: a) b, div() c
mix 1, 2, 3
.render console.log
<div a="1">2<div>3</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