A mechanism is disclosed for allowing an application to perform specified
operations in response to occurrences of a specified event relative to a
specified Smart Card-accessing device. A customized API is exposed to the
application. The application invokes an "addEventListener" method of the
API. The invocation of the method specifies, as parameters of the method,
at least a Smart Card-accessing device, a type of event, and a function.
The server computer executing the application detects the invocation of
the "addEventListener" method. In response to detecting the invocation,
the server determines the type of the event specified by the invocation,
and starts a mechanism that executes the specified function each time
that an event of the specified type occurs relative to the specified
Smart Card-accessing device. Consequently, the application does not need
to be programmed to poll the specified Smart Card-accessing device at
specific times during the application's execution.