app/assets/javascripts/voltron-flash.js in voltron-flash-0.1.1 vs app/assets/javascripts/voltron-flash.js in voltron-flash-0.1.2
- old
+ new
@@ -1,8 +1,10 @@
//= require voltron
Voltron.addModule('Flash', function(){
+ var _initialized = false;
+
var _defaults = {
class: '',
bind: 'body',
id: 'flashes',
containerClass: '',
@@ -16,12 +18,15 @@
autoAdd: true
};
return {
initialize: function(){
- Voltron('Dispatch/addEventWatcher', 'click');
- this.on('click:close-alert', 'click:close-notice', 'click:close-warning', this.clear);
- this.addListener();
+ if(!_initialized){
+ _initialized = true;
+ Voltron('Dispatch/addEventWatcher', 'click');
+ this.on('click:close-alert', 'click:close-notice', 'click:close-warning', this.clear);
+ this.addListener();
+ }
},
setConfig: function(options){
_defaults = $.extend(_defaults, options);
this.afterConfigChange();