-
Notifications
You must be signed in to change notification settings - Fork 0
0.3.0 Prototype
Ivan S Glazunov edited this page Feb 20, 2015
·
3 revisions
new T.Prototype() => this;
The main class for all classes.
Not intended for use immediately! Only inheritance!
Remove need for using new operator.
// Required use a new the first assembly.
var i0 = new Prototype();
var c0 = i0.extend();
// You can not use `new` from heir.
var i1 = c0(); // equal to `new c0();`
- ._parent: Prototype
- ._arguments: arguments
- .returner() => any
- .constructor(...arguments: TArguments) => any
- .extend(...arguments: Array<TInjector|string>) => Function
- ._static() => void
Set at inheritance in .extend.
Reference to prototype of this instance.
new Prototype().extend(function() {
var parent = this._parent; // A parent at this particular inheritance.
this.constructor = function() {
this._parent; // Parent at the time of the call. Maybe any subsequent heir.
parent.constructor.apply(this, arguments);
};
});
arguments;
Set at construction.
Always available arguments passed to the .constructor.
() => any;
Sets the behavior at the time of construction.
var c0 = new Prototype().extend(function() {
var parent = this._parent; // A parent at this particular inheritance.
this.returner = function() { return this; };
});
c0(); // => instanceof Prototype == true
var c1 = new Prototype().extend(function() {
var parent = this._parent; // A parent at this particular inheritance.
this.returner = function() { return 123; };
});
c1(); // => 123
(...arguments: TArguments) => any;
Sets the behavior at the time of construction in TInjector.
var c = new Prototype().extend(function() {
this.constructor = function(a, b, c) {
this.temp = a+b+c;
};
});
c(1, 2, 3).temp; // => 6
(...arguments: Array<TInjector|string>) => Function;
About TInjector.
var c0 = new Prototype().extend(function() {
this.constructor = function(a, b, c) {
this.temp = a+b+c;
};
});
var i0 = c0(1, 2, 3);
i0.temp; // 6
var c1 = i0.extend(function() {
this.constructor = function() {
this.temp += this.temp;
};
});
var i1 = c1();
i1.temp; // 12
Static methods.
var c0 = new Prototype().extend('temp', function() {
this.temp = function() { return 123; };
});
c0.temp(); // 123
() => void;
Is called when a successor constructor.
Allows you to create static options.
- 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