Skip to content

Commit 1149af8

Browse files
authored
Merge pull request #75 from reiern70/reiern70/jQuer40
add support for jQuery 4
2 parents 8b380c7 + 25ebbc3 commit 1149af8

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/bootstrap-notify.coffee

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@
204204
zIndex: @settings.z_index + 1
205205
return
206206

207+
isFunction: (element) ->
208+
typeof element == 'function'
207209
placement: ->
208210
self = this
209211
offsetAmt = @settings.offset.y
@@ -235,19 +237,19 @@
235237
if @settings.newest_on_top == true
236238
offsetAmt = parseInt(offsetAmt) + parseInt(@settings.spacing) + @$ele.outerHeight()
237239
@reposition offsetAmt
238-
if $.isFunction(self.settings.onShow)
240+
if self.isFunction(self.settings.onShow)
239241
self.settings.onShow.call @$ele
240242
@$ele.one(@animations.start, ->
241243
hasAnimation = true
242244
return
243245
).one @animations.end, ->
244246
self.$ele.removeClass self.settings.animate.enter
245-
if $.isFunction(self.settings.onShown)
247+
if self.isFunction(self.settings.onShown)
246248
self.settings.onShown.call this
247249
return
248250
setTimeout (->
249251
if !hasAnimation
250-
if $.isFunction(self.settings.onShown)
252+
if self.isFunction(self.settings.onShown)
251253
self.settings.onShown.call this
252254
return
253255
), 600
@@ -258,7 +260,7 @@
258260
@$ele.find('[data-notify="dismiss"]').on 'click', ->
259261
self.close()
260262
return
261-
if $.isFunction(self.settings.onClick)
263+
if self.isFunction(self.settings.onClick)
262264
@$ele.on 'click', (event) ->
263265
if event.target != self.$ele.find('[data-notify="dismiss"]')[0]
264266
self.settings.onClick.call this, event
@@ -291,20 +293,20 @@
291293
hasAnimation = false
292294
@$ele.attr('data-closing', 'true').addClass @settings.animate.exit
293295
self.reposition posX
294-
if $.isFunction(self.settings.onClose)
296+
if self.isFunction(self.settings.onClose)
295297
self.settings.onClose.call @$ele
296298
@$ele.one(@animations.start, ->
297299
hasAnimation = true
298300
return
299301
).one @animations.end, ->
300302
$(this).remove()
301-
if $.isFunction(self.settings.onClosed)
303+
if self.isFunction(self.settings.onClosed)
302304
self.settings.onClosed.call this
303305
return
304306
setTimeout (->
305307
if !hasAnimation
306308
self.$ele.remove()
307-
if $.isFunction(self.settings.onClosed)
309+
if self.isFunction(self.settings.onClosed)
308310
self.settings.onClosed.call this
309311
return
310312
), 600

0 commit comments

Comments
 (0)