The Gallery is deprecated. No new Gallery components may be submitted, and modifying existing components is disabled. For more information please read the Gallery Deprecation blog post. This is a static snapshot of the Gallery for archive purposes.
See 42 more by this user. Created: 12/5/11
Last CDN Push: 06/20/12
Build Tag: gallery-2012.06.20-20-07
Project: YUI 3
License: YUI BSD
YUI Version: 3.5.1
Free for use.
Y.AsyncCommand instances are designed to be one time use only. This plugin adds a clone method to help facilitate running the same command many times.
If you haven't seen gallery-async, start there: http://yuilibrary.com/gallery/show/Async
It provides convenient syntax so you may not ever need to deal with AsyncCommand instances directly. For example, you could pass the same command function several times into runAll or runQueue instead of creating an AsyncCommand instance and cloning it.
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>
YUI({
//Last Gallery Build of this module
gallery: 'gallery-2012.06.20-20-07'
}).use('gallery-async-command-clone', function(Y) {
var value = 5,
asyncCommand = new Y.AsyncCommand({
fn: function (success) {
Y.later(1000, null, function () {
value += value;
success();
});
}
}).plug(Y.Plugin.AsyncCommandClone);
Y.Async.runAll([
asyncCommand.clone.clone(),
asyncCommand.clone.clone(),
asyncCommand.clone.clone(),
asyncCommand.clone.clone(),
asyncCommand.clone.clone()
]).on('complete', function () {
alert(value);
});
});
All code on this site is licensed under the BSD License unless stated otherwise.