Convert jQuery events to a jQuery Deferred