Skip to content

Instantly share code, notes, and snippets.

Created March 8, 2013 06:49
Show Gist options
  • Save anonymous/5114672 to your computer and use it in GitHub Desktop.
Save anonymous/5114672 to your computer and use it in GitHub Desktop.
jQuery Effect queue for Haxe
package sample;
import jQuery.JQuery;
using Lambda;
class JQueryHelper {
/*
* アニメーションキューを作成する
*/
public static function queueAnimation(effects: Array<Void -> JQuery>): jQuery.Deferred {
return effects.fold(
function(effect: Void -> JQuery, d: jQuery.Deferred) {
return d.then(effect);
},
new jQuery.Deferred().resolve()
);
}
}
package sample;
import jQuery.JQuery;
import sample.JQueryHelper;
class Main {
static main() {
JQueryHelper.queueAnimation([
function() { new Jquery(someselector1).fadeOut(); },
function() { new JQuery(someselector2).fadeIn(); },
...
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment