Ada Extensions
Reference

Events

The events AdanotchKit.events can listen to, their payloads and the permissions they need.

const off = AdanotchKit.events.on("battery.change", (battery, ctx) => {
  if (battery.percentage < 20 && !battery.isCharging) ctx.refresh();
});
off(); // unsubscribes
  • A handler gets (payload, ctx) and can be async.
  • Subscribing to an event without its permission throws a PermissionError; an unknown event name throws a TypeError.
  • An error in a handler is logged and doesn't stop the extension.

Prop

Type