goodybag / bootstrap-notify

Bootstrap alert system made better, builds off of bootstrap-alert.js
http://goodybag.github.com/bootstrap-notify
823 stars 229 forks source link

#bug with `onClosed` - next callback overrides previous #17

Closed al6x closed 11 years ago

al6x commented 11 years ago

Next onClosed callback overrides previous on another notification.

How to reproduce:

Show two notifications, first prints first closed, second second closed when they are closed.

$('.js-notifications').notify({
  message: {text: 'First' }, 
  fadeOut: {enabled: false}, 
  onClosed: function(){console.log('first closed')}
}).show();

$('.js-notifications').notify({
  message: {text: 'Second' }, 
  fadeOut: {enabled: false}, 
  onClosed: function(){console.log('second closed')}
}).show();

Close both of them.

Expected result:

first closed
second closed

Actual result:

second closed
second closed
amatsoukas commented 11 years ago

The fix is in issue #10

on line #25:

replace: this.options = $.extend(true,$.fn.notify.defaults, options)

with: this.options = $.extend(true, {},$.fn.notify.defaults, options)

al6x commented 11 years ago

Thanks, closing it as duplication of #10