-
Notifications
You must be signed in to change notification settings - Fork 0
0.2.3 usage data
Ivan S Glazunov edited this page Feb 20, 2015
·
2 revisions
All data passed to the content or attributes are not static. They are rendered at the time of render calls element. Due to this, they may comprise calculated values.
By the static is not calculated automatically include all types of standard JavaScript types.
Calculates types are elements and special functions, synchronous and asynchronous.
Example of synchronous and asynchronous functions:
var asSync = Templates.asSync, asAsync = Templates.asAsync;
div()(asSync(function() { return 'sync'; })).render(console.log); // <div>sync</div>
div()(asAsync(function(callback) { callback('async'); })).render(console.log); // <div>async</div>
The return value is again subjected to rendering. This means that you can return items in any form.
div()(asSync(function() { return div; })).render(console.log); // <div><div></div></div>
div()(asAsync(function(callback) { callback(div); })).render(console.log); // <div><div></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