NOBUG: Fixed file access permissions
[moodle.git] / lib / yuilib / 3.13.0 / tree-lazy / tree-lazy-min.js
blob67aa2198acc46d54d555f353a03a10a84e558606
1 /*
2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
8 YUI.add("tree-lazy",function(e,t){var n="beforeLoad",r="error",i="load";e.namespace("Plugin.Tree").Lazy=e.Base.create("lazyTreePlugin",e.Plugin.Base,[],{initializer:function(e){this._host=e.host,e.load&&(this.load=e.load),!this._host.openNode,this._published={},this._attachEvents()},load:function(e,t){t(new Error("Plugin.Tree.Lazy: Please provide a custom `load` method when instantiating this plugin."))},_attachEvents:function(){this.onHostEvent("open",this._onOpen)},_onOpen:function(e){var t=e.node;if(!t.canHaveChildren||t.state.loaded||t.state.loading)return;this._published[n]||(this._published[n]=this.publish(n,{defaultFn:this._defLoadingFn})),this.fire(n,{node:t})},_defLoadingFn:function(e){var t=e.node,n=this;t.state.loading=!0,this.load(t,function(e){delete t.state.loading;if(e){n.fire(r,{error:e,src:"load"});return}t.state.loaded=!0,n.fire(i,{node:t})})}},{NS:"lazy"})},"3.13.0",{requires:["base-pluginhost","plugin","tree"]});