Arctic Events
The actual version is 0.1.0, these badges are always out of date for me or take for ever to update.
The core concept here is to register an event or multiple events and to trigger said events.
I wanted to build this library as a learning exercise more then anything.
Installing:
yarn add arctic-events // In your JS: const EventHandler = ;
Getting Started
We need to create an EventHandler which handles the events that you then register, to do this we can extend the class EventHandler
or we can use it as is. For the examples below, we will extend the class:
{}; const myEventHandler = ; myEventHandler; myEventHandler; // => hello world.
Here we see we register an event, trigger it and see the results.
Parameters
What if your events takes in parameters?
{}; const myEventHandler = ; myEventHandler; myEventHandler; // Shows the following: abMyEventHandler events: name: 'event' cb: Function
We have an additional parameter that we pass in. this
which gives you back the
EventHandler
class object (in this case the subclass: MyEventHandler
). You see this with the third param eventHandler
.