Skip to content

Commit a2ad143

Browse files
committed
add support for jQuery 4
1 parent 8b380c7 commit a2ad143

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/bootstrap-notify.coffee

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

207+
isFunction = (element) ->
208+
return typeof element === 'function';
209+
207210
placement: ->
208211
self = this
209212
offsetAmt = @settings.offset.y
@@ -235,19 +238,19 @@
235238
if @settings.newest_on_top == true
236239
offsetAmt = parseInt(offsetAmt) + parseInt(@settings.spacing) + @$ele.outerHeight()
237240
@reposition offsetAmt
238-
if $.isFunction(self.settings.onShow)
241+
if self.isFunction(self.settings.onShow)
239242
self.settings.onShow.call @$ele
240243
@$ele.one(@animations.start, ->
241244
hasAnimation = true
242245
return
243246
).one @animations.end, ->
244247
self.$ele.removeClass self.settings.animate.enter
245-
if $.isFunction(self.settings.onShown)
248+
if self.isFunction(self.settings.onShown)
246249
self.settings.onShown.call this
247250
return
248251
setTimeout (->
249252
if !hasAnimation
250-
if $.isFunction(self.settings.onShown)
253+
if self.isFunction(self.settings.onShown)
251254
self.settings.onShown.call this
252255
return
253256
), 600
@@ -258,7 +261,7 @@
258261
@$ele.find('[data-notify="dismiss"]').on 'click', ->
259262
self.close()
260263
return
261-
if $.isFunction(self.settings.onClick)
264+
if self.isFunction(self.settings.onClick)
262265
@$ele.on 'click', (event) ->
263266
if event.target != self.$ele.find('[data-notify="dismiss"]')[0]
264267
self.settings.onClick.call this, event
@@ -291,20 +294,20 @@
291294
hasAnimation = false
292295
@$ele.attr('data-closing', 'true').addClass @settings.animate.exit
293296
self.reposition posX
294-
if $.isFunction(self.settings.onClose)
297+
if self.isFunction(self.settings.onClose)
295298
self.settings.onClose.call @$ele
296299
@$ele.one(@animations.start, ->
297300
hasAnimation = true
298301
return
299302
).one @animations.end, ->
300303
$(this).remove()
301-
if $.isFunction(self.settings.onClosed)
304+
if self.isFunction(self.settings.onClosed)
302305
self.settings.onClosed.call this
303306
return
304307
setTimeout (->
305308
if !hasAnimation
306309
self.$ele.remove()
307-
if $.isFunction(self.settings.onClosed)
310+
if self.isFunction(self.settings.onClosed)
308311
self.settings.onClosed.call this
309312
return
310313
), 600

0 commit comments

Comments
 (0)