Skip to content

0.0.7

Latest
Compare
Choose a tag to compare
@herudi herudi released this 30 Jul 07:36

New

  • Add Event API.
const evt = new EventTarget();

evt.addEventListener("hello", (evt) => {
  console.log(evt);
});

setTimeout(() => {
  evt.dispatchEvent(new Event("hello"))  
}, 2000);

// using CustomEvent
evt.addEventListener("custom", (evt) => {
  console.log(evt.detail.text());
});

setTimeout(() => {
  evt.dispatchEvent(new CustomEvent("custom", {  detail: { text: () => "Hello From Event" } }))  
}, 2000);