Skip to content

Commit

Permalink
[#3] Updated non-lifecycle methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevraeka committed Feb 23, 2015
1 parent 561ba6b commit 4d80cc8
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions src/x-carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,58 @@
xtag.register('x-carousel', {
lifecycle: {
// Fires when an instance of the element is created
created: function() {
created: function () {
this._items = [];
},

// Fires when an instance was inserted into the document
inserted: function() {
inserted: function () {
this.loadItems();
this.loadTheme();
},
// Fires when an instance was removed from the document
removed: function () {

},

loadTheme: function(){
// Fires when an attribute was added, removed, or updated
attributeChanged: function (attr, oldVal, newVal) {

}
},

events: {},
accessors: {},
methods: {

loadTheme: function () {

},

options: function(){
options: function () {
// TODO: refactor into
if(this.lazyload !== undefined && this.lazyload !== null){
if (this.lazyload !== undefined && this.lazyload !== null) {
// load items lazy
}
if(this.wrap !== undefined && this.wrap !== null) {
if (this.wrap !== undefined && this.wrap !== null) {
// wrap items
}

// controls
},

loadItems: function(){
if(this.items !== undefined && this.items !== null && this.items !== ""){
loadItems: function () {
if (this.items !== undefined && this.items !== null && this.items !== "") {
// load JSON based on path
}

if(this.childNodes('li').length > 0) {
if (this.childNodes('li').length > 0) {
[].forEach.call(this.querySelectorAll('li'), function (carouselItem) {
this._items.push({"item" : carouselItem, "content" : carouselItem.innerHTML })
this._items.push({"item": carouselItem, "content": carouselItem.innerHTML})
}.bind(this));
}
},

// Fires when an instance was removed from the document
removed: function() {

},

// Fires when an attribute was added, removed, or updated
attributeChanged: function(attr, oldVal, newVal) {

}
},
events: {},
accessors: {},
methods: {}
}
});
}());
</script>

0 comments on commit 4d80cc8

Please sign in to comment.