# Subscribing to Precision I/O Events

By default a precision I/O event does not notify the vision application when it fires. If you want your application to be notified when a configured precision I/O event fires, you must write a script function and then add a delegate function that calls the script function to the event collection's HostNotification event delegate collection.

You do this by modifying the OnStartup script that configures and adds a precision event as shown in the red lines, shown in theSubscribing to Precision I/O Events - OnStartup (the original script can be found in the Configuring Precision I/O Events via API topic).

Note: It is important to distinguish between the script function and the event delegate function. The event delegate function must be created as a block of inline code written in the OnStartup script. This function, in turn, calls the script function that you write.

In addition to adding the event handler to the HostNotification event collection on startup, it also important that you remove the handler from the HostNotification collection on shutdown. If you do not do this, an additional instance of the handler will be added to the collection each time you enter test mode.

To do this, you must do the following:

- In the OnStartup script, you must store the delegate function in a global tag.
- In the OnShutdown script you must remove the delegate function from the HostNotification collection.