Created
March 8, 2013 06:49
-
-
Save anonymous/5114672 to your computer and use it in GitHub Desktop.
jQuery Effect queue for Haxe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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