John Lindal![]()
Stores instances of JavaScript components. Allows a constructor or factory function to be passed in place of an instance. This enables lazy construction on demand.
One use is to create a global repository of JavaScript components attached to DOM id's, e.g., YUI Buttons built on top of HTML buttons.
Create an InstanceManager, store some objects, and then retrieve them. See the live example for sample code using lazy construction.
<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.05.16-20-37'
}).use('gallery-instancemanager', function(Y)
{
var mgr = new Y.InstanceManager();
mgr.put('a', {a:1});
mgr.put('b', {b:2});
alert(mgr.get('a').a);
alert(mgr.get('b').b);
});No forum posts for this module.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info