Search
View Details

Invokers

Keith Cirkel demonstrates a brand new concept (requires Chrome Canary and the Experimental Web Platform Features flag right now) called Invokers, a proposal from the Open UI group that is polyfillable. You “invoke” events directly on a specific element in the DOM:

<button
  invoketarget="counter"
  invokeaction="increment"> + </button>

<h1 id="el">0</h1>Code language: HTML, XML (xml)

Then you can listen for the invoke event on that element.

el.addEventListener("invoke", (e) => {
  console.log(e.action); // increment
  // do stuff
});Code language: JavaScript (javascript)

Adding interactive functionality to HTML attributes seems to be aligned with the last decade of JavaScript frameworks.

It's time to take your JavaScript to the next level

Frontend Masters logo

Frontend Masters is the best place on the web to really learn JavaScript. We have a complete learning path from the biggest and best teachers in JavaScript to help you make the most out of the web's biggest language.

Leave a Reply

Your email address will not be published. Required fields are marked *

Frontend Masters ❤️ Open Source

Did you know? Frontend Masters Donates to open source projects. $313,806 contributed to date.