API Initialization

Agastya features a powerful API with a number of methods you can call. Note that the Agastya widget already makes use of these APIs and you don't need to use them unless you're building a custom accessibility widget.

To use these methods, you first have to initialize the Agastya API. We don't automatically do this because majority of websites use the built-in Agastya widget than the APIs to build their own accessibility widget. You can call this function to initialize the API, which will then load all relevant scripts:
agastya.API(init); // Optional initialization function
Ideally, you should use the function after including the library.
<script src="https://agastya.oswald.host/latest.js"></script>
<script> agastya.API(); </script>
You can use the initialization function to add your event listeners when the API has loaded or change modes:
agastya.API(function() {
	button.addEventListener("click", agastya.toggle);