-
Notifications
You must be signed in to change notification settings - Fork 0
0.1.0
Ivan S Glazunov edited this page Jan 22, 2015
·
1 revision
OSWS Templates
version: 0.1.0
- Only JavaScript is required!
- Reconfigurable at any time.
- Allows you to work with asynchronous data.
- Reusing elements` structures.
- Inheritance simplicity.
npm install osws-templates
var Templates = require('osws-templates');
You must declare 'lodash' and 'async' in configuration of Require.js.
define(['osws-templates'], function(Templates) {});
- selector ≈ simple string sintax for classes, id and attributes of tag ≈ string
- data ≈ standard of data transfer ≈ Prototype|SyncFunction|AsyncFunction|stringify
- attributes ≈ object hash with tag attributes ≈ { [name: string]: data }
- context ≈ object hash for _.template used on rendering ≈ { [name: string]: data }
- content ≈ array with data
- render ≈ handling Prototype model with all data to static HTML code
- inheritance ≈ content, the name and attributes are always inherited, inheritance is not deep
-
Prototype main prototype, fix need for
new
- Contents > Prototype provides content values and methods
- Tag > Contents methods of generating tags and handling arguments
- Single > Tag methodology unique to a single tags
- Double > Tag methodology unique to a double tags
- Doctype > Tag methodology unique to doctypes
- 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