It is possible to define per-link-type actions, using the Links Inspector. The action is run whenever a link of that type is created. note that the action is associated with an entire link type as opposed to single link. It is not possible to define such an action for a single link (unless that link has its own link type and it is used only once—which seems unlikely).
Changing the link type of an existing link does not invoke the OnLink action.
There is no reverse effect, as in an action that fires when a link is deleted.
When running the OnLink action, the designator source is bound to the link's source note and the designator destination is bound to the link's destination note. The designator this is also bound to the source note, though using 'source' seems to offer greater clarity as to the code purpose.
This action has no associated attribute: the action is a document-level setting and can only be entered via the Links Inspector.
The code is only run once and the OnLink action can be though of as equivalent to applying a stamp to a newly-linked note. Indeed, OnLink code could just consist of code to run stamp(), if so desired.