1
컬렉션 컬렉션을 관리하는 방법을 찾고 있습니다. 아래 예제 코드를 참조하십시오.컬렉션 컬렉션을 관리하는 방법은 무엇입니까?
function Collection() {
this.items = []; //Contains items, which have a date associated with them
}
Collection.prototype.doSomethingOnItems = function(){};
function SuperCollection() {
this.collections = []; //An array of Collection objects
this.group = []; //A vector with a string that designates the group (e.g. 2013, 2012)
}
SuperCollection.prototype.groupCollections = function(items, groupType) {
//Group by year, month, day, etc...
//For example, given a timeframe of 2012-2013, items in 2012 are put in collections[1], those from 2013 are in collections[2]
}
이와 같은 구조를 관리하는 더 좋은 방법이 있습니까?
답변이 되었습니까? – Metalstorm