Skip to content

ryanpcmcquen/eventBoiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eventBoiler

A minimalist, nano-library for using event listeners. 🌋

evBo includes built in throttling thanks to odis.

Fork this fiddle to try it out:

https://jsfiddle.net/ryanpcmcquen/fy84758z/

To include in your project just add the script in the coolest spot 😎

v0.2.2

<script src="https://cdn.rawgit.com/ryanpcmcquen/eventBoiler/c2f5ea7eee7d6dd91195f3be6598229a756990ce/eventBoiler.min.js"></script>

https://cdn.rawgit.com/ryanpcmcquen/eventBoiler/c2f5ea7eee7d6dd91195f3be6598229a756990ce/eventBoiler.min.js

💭 P.S. It is under a kilobyte! 🗿

How do I make it go?

evBo(".foo", "click", function () {
  console.log(this);
});

Here you are adding a click listener to the .foo selector, and apparently your project is pretty lame, because you are just logging it to the console ... 😕

eventBoiler (invoked with evBo), also includes throttling that is turned on by default, if you wish to turn that throttling off, pass false as the last argument, like so:

evBo(".foo", "click", function () {
  console.log(this);
}, false);

To add event listeners to more than one element, use evBo.all:

evBo.all(".foo, .bar, #baz", "click", function () {
  console.log(this);
});

About

🌋 A minimalist (<1KB) nano-library for using event listeners. Called with `evBo`.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published