Is it possible to "wait" for multiple events before executing a function? I know its possible with jQuery
deferred
obejcts to use $.when
to wait for two promises to resolve but I wondered if its possible with just plain old events?
Lets say a click event and a custom event trigger an alert, for example:
$.when("click", "customEvent").then(function(){ alert("yay"); });
Well, Checking event types and setting them in old way. Plain jQuery and JS.
Will alert 1 only when both events are done / fired.
Fiddle
You could use deferred, you just have to create them yourself.