I'm trying to create a new Bootstrap plugin but am unclear on how the API 
is intended to be used. I have compared the JS source of most of the 
plugins to each other and the part I can't figure out is the data-api thing 
at the bottom. They all seem to follow this pattern:

 /* TYPEAHEAD DATA-API
  * ================== */
  $(function () {
    $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', 
function (e) {
      var $this = $(this)
      if ($this.data('typeahead')) return
      e.preventDefault()
      $this.typeahead($this.data())
    })
  })

I don't know the meaning of this "focus.typeahead.data-api" thing. That is 
a pretty big blocker for me. I have JS that I can paste into the console 
that sets an on("resize") handler, but I don't know the correct way to do 
it via a plugin.

Is there good documentation on this anywhere?

Please advise.

Reply via email to