biresourceloader.html
来自「ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.」· HTML 代码 · 共 271 行
HTML
271 行
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--Generated using api.website.xsl version 2003-07-17--><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"><title>BiResourceLoader</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript"> function showDerivedClasses() { var ul = document.getElementById("api-derived-classes"); var lis = ul.childNodes; var l = lis.length; for (var i = 1; i < l; i++) lis[i].style.display = ""; lis[0].style.display = "none"; } </script></head><body><h1 id="BiResourceLoader">BiResourceLoader</h1><p>This class is used to load different kinds of resources. There are basically 3 types of resources that this class can handle. The first 2 are script files and a code string. The third one is a genereal object described by an XML element and in this case an object is created using a<code><a href="BiXmlResourceParser.html">BiXmlResourceParser</a></code>.<br> <br> When creating general objects a few special rules apply. If the created object is an event target the resource loader will listen to <code>load</code> and <code>error</code> events so that it can be notified by the object that it is loaded. If the object has a <code>load()</code> method that will be called if the object is not already loaded. To decide if the object is loaded the resource loader will use <code>getLoaded()</code> if available and if that isn't available it is assumed that the object is loaded (or does not require loading).</p><p>This class extends <code><a href="BiEventTarget.html">BiEventTarget</a></code> and therefore all methods and fields available for <code><a href="BiEventTarget.html">BiEventTarget</a></code> are also available for <code>BiResourceLoader</code>.</p><ul class="partial-class-tree"><li><code><a href="BiObject.html">BiObject</a></code><ul><li><code><a href="BiEventTarget.html">BiEventTarget</a></code><ul><li><code>BiResourceLoader</code><ul id="api-derived-classes"></ul></li></ul></li></ul></li></ul><h2>Constructor</h2><p><code> new BiResourceLoader()</code></p><h3>Parameters</h3><p>No parameters.</p><h2>Properties</h2><table><thead><tr><td>Name</td><td>Type</td><td class="get-header">get</td><td class="set-header">set</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="autoNameMapping"></a><code>autoNameMapping</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>When this is true any XML object that has an id attribute will create a global reference to the object created from this XML element.</td></tr><tr><td><a name="count"></a><code>count</code></td><td><code class="type">Number</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>The number of added resources</td></tr><tr><td><a name="loaded"></a><code>loaded</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Whether all resources have been loaded.</td></tr><tr><td><a name="loadedCount"></a><code>loadedCount</code></td><td><code class="type">Number</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>The number of finished loading resources. This includes inline scripts and general objects as well.</td></tr></tbody></table><h2>Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#abort">abort</a></code></td><td>Stops the current loading</td></tr><tr><td><code><a href="#addResource">addResource</a></code></td><td>Adds a resource that the resource loader will instantiate and load.</td></tr><tr><td><code><a href="#getResourceById">getResourceById</a></code></td><td>Returns the resource with the given id</td></tr><tr><td><code><a href="#load">load</a></code></td><td>Starts the loading of the resource. The loading is done asynchronously so this will return immediately. When all resources are loaded the <code><a href="#load">load</a></code> event will fire.</td></tr></tbody></table><h2>Events</h2><table><thead><tr><td>Name</td><td>Type</td><td class="bubbles-header">Bubbles</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="load"></a><code>load</code></td><td><code class="type"> <code><a href="BiEvent.html">BiEvent</a></code> </code></td><td class="bubbles-column"></td><td>Fires when all the resources have been loaded and executed</td></tr><tr><td><a name="progress"></a><code>progress</code></td><td><code class="type"> <code><a href="BiEvent.html">BiEvent</a></code> </code></td><td class="bubbles-column"></td><td>Fires every time one of the external resources have been loaded. This is useful for providing visual feedback.</td></tr></tbody></table><h2>Static Methods</h2><p>None.</p><h2>Static Fields</h2><p>None.</p><h2>Remarks</h2><p> </p><h2>Method Details</h2><h3><a name="abort"></a>abort</h3><p>Stops the current loading</p><h4>Syntax</h4><pre class="method-syntax">object.abort()</pre><h4>Parameters</h4><p>No arguments.</p><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="addResource"></a>addResource</h3><p>Adds a resource that the resource loader will instantiate and load.</p><h4>Syntax</h4><pre class="method-syntax">object.addResource(<span class="methodArgument">sType</span>, <span class="methodArgument">oData</span> [, <span class="methodArgument">sId</span>])</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sType</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>This is either one of the following 2 types or the name of the class to use to instantiate the object. If a class name is passed then the oData argument should be an XML element that is then used to describe the object.<br> <br> <code>script</code> - the oData is treated as URI of the script file<br> <code>inlinescript</code> - the oDate string is treated as the script code</td></tr><tr><td><code>oData</code></td><td><code class="type">Object</code></td><td class="optional-column"></td><td></td><td>For script this should be the URI of the script file. This is UIR is relative to the ADF file. For inlinescript this is the script code as a string. For a general object this should be an XML element that is then passed to a<code><a href="BiXmlResourceLoader.html">BiXmlResourceLoader</a></code> which will instantiate the object.</td></tr><tr><td><code>sId</code></td><td><code class="type">String</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>Optional id to use to find the source using <code><a href="#getResourceById">getResourceById</a></code>. If a general object is used the id attribute in the XML element is used instead.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="getResourceById"></a>getResourceById</h3><p>Returns the resource with the given id</p><h4>Syntax</h4><pre class="method-syntax">object.getResourceById(<span class="methodArgument">sId</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sId</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>The id of the resource to lookup</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Object</code></p><h3><a name="load"></a>load</h3><p>Starts the loading of the resource. The loading is done asynchronously so this will return immediately. When all resources are loaded the <code><a href="#load">load</a></code> event will fire.</p><h4>Syntax</h4><pre class="method-syntax">object.load()</pre><h4>Parameters</h4><p>No arguments.</p><h4>Return Type</h4><p><code class="type">void</code></p></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?