Good day. I set myself a goal at work - to avoid using such a framework as QOOXDOO. Of course, it is cool and cool, but, unfortunately, you need a python to compile the code (yes, to put the code together, you need a python), and it also weighs 100,500 meters.
In general, I tried to get around without loss for the current project. It turned out like.
Of the possibilities:
- The ability to create a class and its instances.
- The current types of classes that can be created are dynamic, singleton.
- The possibility of "mixing" methods of third-party classes (MICS).
- high inheritance
- Automatic creation of getters, setters and listing and type control for public variables.
- The ability to create static methods outside of static classes.
oooooooooooochen small. Current flaws (to be corrected in a couple of days ... when I sleep enough):
There is no possibility of inheriting singleton. (Functions are written, but the stuffing did not shove. Everything is simple)
An example of the simplest class:
// Mixin class smc.define("MTest", { // Static methds & properties static: { base: 0x100, unit: 0x200, resouce: 0x300 } }); // Mixin class smc.define("MTest2", { // Static methds & properties static: { moto: 0x100, auto: 0x200, velo: 0x300 } }); smc.define("MyFirstClass", { /* * Конструктор. Вызывается при создании нового экземпляра класса. */ construct: function (a,b) { if(a) this.setName(a); if(b) this.setMessage(b); this.helloWorld(); }, /* * Это примесь. Вы можете создать массив и указать SMC классы, * чьи свойства необходимо подмешать в текущий объект класса. * Если такие классы есть - Вы сможете вызвать их методы, из текущего экземпляра, * либо обратится к их переменным */ mixins: [ smc.MTest, smc.MTest2 ], /* * Это паблик- переменные класса. * value: Значение переменной * type: тип переменной (дефолт- любой) * event: Если при изменении значения переменной необходимо вызвать какую-либо функцию, */ properties: { name: { value: "Станислав", type: "string" }, message: { value: "Привет", type: "string", apply: "this.helloWorld" } }, /* * Список паблик функций, либо переменных * (как правило, сюда забрасываются переменные, которые не нуждаются в паблик доступе) */ members: { helloWorld: function () { alert( this.getMesage() + ", " + this.getName()); } }, static: { whatAreFuck: function () { console.log("Это простой статический метод у динамического объекта. Может вызываться без создания экземпляра класса") } } });
You can download it by clicking on this link :) http://download.tracking.by/smc.js