0.0.1 • Published 7 years ago

@simonwep/event-js v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

⭐️ Features

  • Small and fast
  • No jQuery
  • Very Lightweight, > 1KB gzipped

🗜 Install

Via npm

$ npm install @simonwep/event-js --save

Include via jsdelivr.net

<script src="https://cdn.jsdelivr.net/npm/@simonwep/event-js@0.0.1/event.min.js"></script>

Note: Include it at the very bottom of your page!

⚙ Usage

<div e-[Event name]="[Function name]" eo-[Option name]="[Option value]"></div>

Example:

<div e-click="doSomething"></div>
function doSomething() {
    console.log('Hello World!')
}

📜 Methods

  • EventJS.rebind() - Reloads Eventjs and rebind the events.
  • EventJS.destroy() - Destroys EventJS, removes all event-listeners.
  • EventJS.setPrefix(prefix:String) - Set another prefix (instead of e-).
  • EventJS.setOptionsPrefix(prefix:String) - Set another option prefix (instead of e-).

🔥 Event-name and options

Event name e-

Everything that you can pass to .addEventListener. (e-click="..." e-mousedown="..." e-mousemove="..." and so on...)

Event options eo-

  • eo-parent - The path to the object. Example: myobject.mylistener. (the first object must be a children from window)

🛠 Contributing

You have an idea for an option or a feature? Create an issue!

0.0.1

7 years ago