Listen to events in the AMD callback