Getting started
Install listener, create a listener library, and use it 🌅
Install listener
Use the development dependency flag (--save-dev
) if you're creating a listener library and only using the listener
function in tests.
Create a listener library
Listener libraries are basically normal class instances, but with one exception — functions that receive a listener identifier (lid
) as the first argument become listener functions.
Listener functions are special because they can be bound to and extended even if they have asynchronous outputs.
Here we export a class instance with a listener function and save it as logger.ts
:
Arguments after the first listener id argument (lid
) can be whatever you like.
Using a listener library
Here we show how to load a library with the listener.load
function.
① Load the listener library, call the listener function, and save it as main.ts
:
② Execute main.ts
and view the output:
From the output, we see that calling a listener function automatically prepends its name to the identifier.
What's next?
Welcome to the world of dynamic libraries! 🌐
pageIdentifierspageCallbackspageBindingsLast updated