| Total Complexity | 8 |
| Complexity/F | 1.33 |
| Lines of Code | 33 |
| Function Count | 6 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | Mivhak.component('notifier', { |
||
| 2 | template: '<div class="mivhak-notifier"></div>', |
||
| 3 | methods: { |
||
| 4 | notification: function(html) { |
||
| 5 | if(!html) return; |
||
| 6 | clearTimeout(this.timeout); |
||
| 7 | this.$el.off('click'); |
||
| 8 | this.$el.html(html); |
||
| 9 | this.$el.addClass('mivhak-visible'); |
||
| 10 | }, |
||
| 11 | timedNotification: function(html, timeout) { |
||
| 12 | var $this = this; |
||
| 13 | this.notification(html); |
||
| 14 | this.timeout = setTimeout(function(){ |
||
| 15 | $this.hide(); |
||
| 16 | },timeout); |
||
| 17 | }, |
||
| 18 | closableNotification: function(html, onclick) |
||
| 19 | { |
||
| 20 | var $this = this; |
||
| 21 | this.notification(html); |
||
| 22 | this.$el.addClass('mivhak-button'); |
||
| 23 | this.$el.click(function(e){ |
||
| 24 | $this.hide(); |
||
| 25 | if(typeof onclick !== 'undefined') |
||
| 26 | onclick.call(null, e); |
||
| 27 | }); |
||
| 28 | }, |
||
| 29 | hide: function() { |
||
| 30 | this.$el.removeClass('mivhak-visible mivhak-button'); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | }); |