Join
Connect libraries without introducing "hard" production dependencies.
① Create a library that joins itself with another and save it as joinExample.ts
:
The logger library in this example comes from the getting started section.
The imports in this example has no effect on compiled output. They are purely for accessing types.
② Load the listener libraries, call the hi
function, and save it as main.ts
:
③ Execute main.ts
and view the output:
Asynchronous loading
In the previous example, we also could have loaded the libraries using dynamic imports:
The top-level joinExample
import in this example has no effect on compiled output. It is purely for accessing types.
Listener joined callback
The listenerJoined
callback is executed on the library that is joined to another library.
Define a listenerJoined
callback function within a listener library:
Callback arguments
The listenerJoined
callback receive two arguments, a listener id (lid
) and a listener join event object that adds extra information to the listener event:
Last updated