-
Notifications
You must be signed in to change notification settings - Fork 0
0.2.0 type TData
Describes the Protocol data storage in unfinished form. When rendering with Templates.dataRender, depending on the type of data are converted into result format.
- Protocol of data storage.
- Supports multi-layered data.
- Used with Templates.dataRender.
Instance can be placed in several ways.
As instanceof
Prototype
var data: TData = Templates.doubles.div()(); // As example.
As a method with option __templatesInstance
as reference to an instance of the Prototype.
Any function automatically wraps using Templates.wrapMethod.
var content = Templates.doubles.div(); // Returns `.content` wrapped method.
var data: TData = content; // Not necessarily to call content.
var data: TData = Templates.doubles.div();
As a direct reference to the function-class constructor heir of Prototype. Allows not create tag and simplify the writing.
var data: TData = Templates.doubles.div;
type TSync = () => any;
Form of transfer function returns a static result for rendering.
var sync: TSync = () => { return fs.readFileSync('data'); };
var data: TData = sync;
Form of transfer function returns a static result for rendering.
var sync: TAsync = (callback: (result: any) => void) => {
fs.readFile('data', (error, result) => {
callback(result);
});
};
var data: TData = sync;
Any other type of objects will be verified by key in the search for appropriate TData types.
- 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