Skip to content

Commit 4d80cc8

Browse files
committed
[#3] Updated non-lifecycle methods
1 parent 561ba6b commit 4d80cc8

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

src/x-carousel.html

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,58 @@
66
xtag.register('x-carousel', {
77
lifecycle: {
88
// Fires when an instance of the element is created
9-
created: function() {
9+
created: function () {
1010
this._items = [];
1111
},
1212

1313
// Fires when an instance was inserted into the document
14-
inserted: function() {
14+
inserted: function () {
1515
this.loadItems();
1616
this.loadTheme();
1717
},
18+
// Fires when an instance was removed from the document
19+
removed: function () {
20+
21+
},
1822

19-
loadTheme: function(){
23+
// Fires when an attribute was added, removed, or updated
24+
attributeChanged: function (attr, oldVal, newVal) {
25+
26+
}
27+
},
28+
29+
events: {},
30+
accessors: {},
31+
methods: {
32+
33+
loadTheme: function () {
2034

2135
},
2236

23-
options: function(){
37+
options: function () {
2438
// TODO: refactor into
25-
if(this.lazyload !== undefined && this.lazyload !== null){
39+
if (this.lazyload !== undefined && this.lazyload !== null) {
2640
// load items lazy
2741
}
28-
if(this.wrap !== undefined && this.wrap !== null) {
42+
if (this.wrap !== undefined && this.wrap !== null) {
2943
// wrap items
3044
}
3145

3246
// controls
3347
},
3448

35-
loadItems: function(){
36-
if(this.items !== undefined && this.items !== null && this.items !== ""){
49+
loadItems: function () {
50+
if (this.items !== undefined && this.items !== null && this.items !== "") {
3751
// load JSON based on path
3852
}
3953

40-
if(this.childNodes('li').length > 0) {
54+
if (this.childNodes('li').length > 0) {
4155
[].forEach.call(this.querySelectorAll('li'), function (carouselItem) {
42-
this._items.push({"item" : carouselItem, "content" : carouselItem.innerHTML })
56+
this._items.push({"item": carouselItem, "content": carouselItem.innerHTML})
4357
}.bind(this));
4458
}
45-
},
46-
47-
// Fires when an instance was removed from the document
48-
removed: function() {
49-
50-
},
51-
52-
// Fires when an attribute was added, removed, or updated
53-
attributeChanged: function(attr, oldVal, newVal) {
54-
5559
}
56-
},
57-
events: {},
58-
accessors: {},
59-
methods: {}
60+
}
6061
});
6162
}());
6263
</script>

0 commit comments

Comments
 (0)