mardi 25 septembre 2018

What design pattern bootstrap v4 uses on the click event

Here is a snippet I am trying to figure out

$(document).on(
Event.CLICK_DATA_API,
Selector.DISMISS,
Alert._handleDismiss(new Alert()) )

This snippet is part of the Alert component:

https://github.com/twbs/bootstrap/blob/v4-dev/js/src/alert.js

I am trying to understand why on a click event we are trying to pass a new Alert() rather than just an instance of or let the event.target do the heavy lifting on the listener.

Aucun commentaire:

Enregistrer un commentaire