|
6 | 6 | xtag.register('x-carousel', {
|
7 | 7 | lifecycle: {
|
8 | 8 | // Fires when an instance of the element is created
|
9 |
| - created: function() { |
| 9 | + created: function () { |
10 | 10 | this._items = [];
|
11 | 11 | },
|
12 | 12 |
|
13 | 13 | // Fires when an instance was inserted into the document
|
14 |
| - inserted: function() { |
| 14 | + inserted: function () { |
15 | 15 | this.loadItems();
|
16 | 16 | this.loadTheme();
|
17 | 17 | },
|
| 18 | + // Fires when an instance was removed from the document |
| 19 | + removed: function () { |
| 20 | + |
| 21 | + }, |
18 | 22 |
|
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 () { |
20 | 34 |
|
21 | 35 | },
|
22 | 36 |
|
23 |
| - options: function(){ |
| 37 | + options: function () { |
24 | 38 | // TODO: refactor into
|
25 |
| - if(this.lazyload !== undefined && this.lazyload !== null){ |
| 39 | + if (this.lazyload !== undefined && this.lazyload !== null) { |
26 | 40 | // load items lazy
|
27 | 41 | }
|
28 |
| - if(this.wrap !== undefined && this.wrap !== null) { |
| 42 | + if (this.wrap !== undefined && this.wrap !== null) { |
29 | 43 | // wrap items
|
30 | 44 | }
|
31 | 45 |
|
32 | 46 | // controls
|
33 | 47 | },
|
34 | 48 |
|
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 !== "") { |
37 | 51 | // load JSON based on path
|
38 | 52 | }
|
39 | 53 |
|
40 |
| - if(this.childNodes('li').length > 0) { |
| 54 | + if (this.childNodes('li').length > 0) { |
41 | 55 | [].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}) |
43 | 57 | }.bind(this));
|
44 | 58 | }
|
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 |
| - |
55 | 59 | }
|
56 |
| - }, |
57 |
| - events: {}, |
58 |
| - accessors: {}, |
59 |
| - methods: {} |
| 60 | + } |
60 | 61 | });
|
61 | 62 | }());
|
62 | 63 | </script>
|
0 commit comments