-
Notifications
You must be signed in to change notification settings - Fork 0
0.2.2 t 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.
- Used with Templates.dataRender.
- Handles many types of data.
Applies everywhere in the module.
- The content in any form is render as TData.
- The attributes of the tags are rendered as TData.
- The context is passed when the rendering is render as TData.
There will be no code producing the rendering. Only TData before rendering, and results after rendering.
Standard type for JavaScript not change their behavior. If you will be given a number, string, function, array, object, or null, they will be transferred to the rendering literally unchanged.
Exceptional behavior:
Elements sended in any form, will be render.
-
div
to<div></div>
-
div('.class')
to<div class="class"></div>
-
div('.class')('content')
to<div class="class">content</div>
-
img
to<img/>
-
img('.class')
to<img class="class"/>
-
doctype.html
to<!DOCTYPE html>
-
doctype.html('[PUBLIC]')
to<!DOCTYPE html PUBLIC>
-
content
to -
content('text')
totext
Possible to send the generated, calculated content.
-
asSync(function() { return 'sync'; })
tosync
-
asAsync(function(callback) { callback('async'); })
toasync
The return value is again subjected to rendering. This means that you can return items in any form.
-
asSync(function() { return div; })
to<div></div>
-
asAsync(function(callback) { callback(div('.class')('content')); })
to<div class="class">content</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