I have some questions about Jquery's Tigger.

this.$element.trigger(`init.zf.${pluginName}`);

I don"t understand very well, there is no declaration of any events like "init.zf.xxx" in the code, so what does this trigger trigger?

Mar.13,2021

this event is provided to consumers and does not need to be declared here, such as element.on ("xxx", function () {})


The constructor should also call an _ init () method, and if needed an _ events () method, followed by a DOM event indicating that the plugin is done being initialized.

function Plugin(element, options) {
  // ...

  this._init();
  this._events();
  this.$element.trigger('init.zf.plugin');
}

: followed by a DOM event indicating that the plugin is done being initialized, is fascinated to see this expression on the official website

Menu