Задача 1:
//container.js
define(function() {
'use strict';
var Container;
Container = (function() {
function Container() {
this.container = [];
}
Container.prototype.add = function(section) {
this.container.push(section);
};
Container.prototype.getData = function() {
return this.container;
};
return Container;
}());
return Container;
});
//section.js
define(function() {
'use strict';
var Section;
Section = (function() {
function Section(title) {
this.title = title;
this.content = [];
}
Section.prototype.add = function(item) {
this.content.push(item);
};
Section.prototype.getData = function() {
return {
title: this.title,
content: this.content
};
};
return Section;
}());
return Section;
});
//item.js
define(function() {
'use strict';
var Item;
Item = (function() {
function Item(content) {
this.content = content;
}
Item.prototype.getData = function() {
return {
content: this.content
};
};
return Item;
})();
return Item;
});