Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / native_client_sdk / doc_generated / devguide / coding / progress-events.html
index 9988821..70adb6c 100644 (file)
 
 </div><p>There are five types of events that developers can respond to in Native Client:
 progress, message, view change, focus, and input events (each described in the
-glossary below). This chapter describes how to monitor progress events (events
+glossary below). This section describes how to monitor progress events (events
 that occur during the loading and execution of a Native Client module). This
-chapter assumes you are familiar with the material presented in the
+section assumes you are familiar with the material presented in the
 <a class="reference internal" href="/native-client/overview.html"><em>Technical Overview</em></a>.</p>
 <aside class="note">
 The load_progress example illustrates progress event handling. You can find
-this code in the <code>/examples/tutorial/load_progress/</code> directory in the Native
-Client SDK download.
+this code in the <code>/pepper_&lt;version&gt;/examples/tutorial/load_progress/</code>
+directory in the Native Client SDK download.
 </aside>
-<section id="module-loading-and-progress-events">
 <h2 id="module-loading-and-progress-events">Module loading and progress events</h2>
 <p>The Native Client runtime reports a set of state changes during the module
 loading process by means of DOM progress events. This set of events is a direct
@@ -35,29 +34,26 @@ events types reported by the Native Client runtime:</p>
 </colgroup>
 <thead valign="bottom">
 <tr class="row-odd"><th class="head">Event</th>
-<th class="head">Description</th>
-<th class="head">Number of
-times
+<th class="head">Times
 triggered</th>
-<th class="head">When event is
+<th class="head">When
 triggered</th>
 <th class="head">How you might
-react to
-event</th>
+respond</th>
 </tr>
 </thead>
 <tbody valign="top">
-<tr class="row-even"><td><code>loadstart</code></td>
-<td>Native Client has
-started to load a
-Native Client
-module.</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>loadstart</code></dt>
+<dd>Native Client has started to
+load a Native Client module.</dd>
+</dl>
+</td>
 <td>once</td>
-<td>This is the
+<td>The
 first
 progress
 event
-triggered
 after the
 Native Client
 module is
@@ -70,9 +66,12 @@ message, such
 as
 &#8220;Loading...&#8221;</td>
 </tr>
-<tr class="row-odd"><td><code>progress</code></td>
-<td>Part of the module
-has been loaded.</td>
+<tr class="row-odd"><td><dl class="first last docutils">
+<dt><code>progress</code></dt>
+<dd>Part of the module has been
+loaded.</dd>
+</dl>
+</td>
 <td>zero or
 more</td>
 <td>After
@@ -82,31 +81,24 @@ dispatched.</td>
 <td>Display a
 progress bar.</td>
 </tr>
-<tr class="row-even"><td><code>error</code></td>
-<td>The Native Client
-module failed to
-start execution
-(includes any
-error before or
-during
-initialization of
-the module). The
-<code>lastError</code>
-attribute
-(mentioned later)
-provides details
-on the error
-(initialization
-failed, sel_ldr
-did not start,
-and so on).</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>error</code></dt>
+<dd>The Native Client module failed
+to start execution (includes any
+error before or during
+initialization of the module).
+The <code>lastError</code> attribute
+(mentioned later) provides
+details on the error
+(initialization failed, sel_ldr
+did not start, and so on).</dd>
+</dl>
+</td>
 <td>zero or
 once</td>
-<td>After the
-last
+<td>After the last
 <code>progress</code>
-event has
-been
+event has been
 dispatched,
 or after
 <code>loadstart</code>
@@ -120,21 +112,19 @@ application
 failed to
 load.</td>
 </tr>
-<tr class="row-odd"><td><code>abort</code></td>
-<td>Loading of the
-Native Client
-module was
-aborted by the
-user.</td>
+<tr class="row-odd"><td><dl class="first last docutils">
+<dt><code>abort</code></dt>
+<dd>Loading of the NativeClient
+module was aborted by the user.</dd>
+</dl>
+</td>
 <td>zero or
 once</td>
-<td>After the
-last
+<td>After the last
 <code>progress</code>
-event has
-been
-dispatched,
-or after
+event has been
+dispatched, or
+after
 <code>loadstart</code>
 if no
 <code>progress</code>
@@ -146,25 +136,23 @@ will want to
 respond to
 this event.</td>
 </tr>
-<tr class="row-even"><td><code>load</code></td>
-<td>The Native Client
-module was
-successfully
-loaded, and
-execution was
-started. (The
-module was
-initialized
-successfully.)</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>load</code></dt>
+<dd>The Native Client module was
+successfully loaded, and
+execution was started.
+(The module was initialized
+successfully.)</dd>
+</dl>
+</td>
 <td>zero or
 once</td>
 <td>After the
 last
 <code>progress</code>
-event has
-been
-dispatched,
-or after
+event has been
+dispatched, or
+after
 <code>loadstart</code>
 if no
 <code>progress</code>
@@ -173,17 +161,15 @@ dispatched.</td>
 <td>Remove the
 progress bar.</td>
 </tr>
-<tr class="row-odd"><td><code>loadend</code></td>
-<td>Loading of the
-Native Client
-module has
-stopped. Load
-succeeded
-(<code>load</code>),
-failed
-(<code>error</code>), or
-was aborted
-(<code>abort</code>).</td>
+<tr class="row-odd"><td><dl class="first last docutils">
+<dt><code>loadend</code></dt>
+<dd>Loading of the Native Client
+module has stopped. Load
+succeeded (<code>load</code>), failed
+(<code>error</code>), or was aborted
+(<code>abort</code>).</dd>
+</dl>
+</td>
 <td>once</td>
 <td>After an
 <code>error</code>,
@@ -194,28 +180,24 @@ dispatched.</td>
 <td>Indicate
 loading is
 over
-(regardless
-of failure or
+(regardless of
+failure or
 not).</td>
 </tr>
-<tr class="row-even"><td><code>crash</code></td>
-<td>The Native Client
-module is not
-responding (died
-on an
-<code>assert()</code> or
-<code>exit()</code>) after
-a successful
-load. This event
-is unique to
-Native Client and
-is not part of
-the W3C Progress
-Events standard.
-The <code>exitStatus</code>
-attribute provides
-the numeric exit
-status value.</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>crash</code></dt>
+<dd>The Native Client module is not
+responding (died on an
+<code>assert()</code> or <code>exit()</code>)
+after a successful load. This
+event is unique to Native Client
+and is not part of the W3C
+Progress Events standard. The
+<code>exitStatus</code> attribute
+provides the numeric exit
+status.</dd>
+</dl>
+</td>
 <td>zero or
 once</td>
 <td>After a
@@ -257,7 +239,6 @@ illegal.</td>
 </table>
 <p>Errors that occur during loading are logged to the JavaScript console in Google
 Chrome (select the menu icon <img alt="menu-icon" src="/native-client/images/menu-icon.png" /> &gt; Tools &gt; JavaScript console).</p>
-</section><section id="handling-progress-events">
 <h2 id="handling-progress-events">Handling progress events</h2>
 <p>You should add event listeners in a <code>&lt;script&gt;</code> element to listen for these
 events before the <code>&lt;embed&gt;</code> element is parsed. For example, the following code
@@ -299,7 +280,6 @@ listeners on outer elements (including the <code>&lt;body&gt;</code> element) to
 from inner elements. For more information, see the W3 specifications for <a class="reference external" href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-capture">event
 flow capture</a> and
 <a class="reference external" href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">event listener registration</a>.</p>
-</section><section id="displaying-load-status">
 <h2 id="displaying-load-status">Displaying load status</h2>
 <p>One common response to progress events is to display the percentage of the
 module that has been loaded. In the load_progress example, when the <code>progress</code>
@@ -323,7 +303,6 @@ function moduleLoadProgress(event) {
   }
 }
 </pre>
-</section><section id="the-lasterror-attribute">
 <h2 id="the-lasterror-attribute">The <code>lastError</code> attribute</h2>
 <p>The <code>&lt;embed&gt;</code> element has a <code>lastError</code> attribute that is set to an
 informative string whenever a load failure (an <code>error</code> or <code>abort</code> event)
@@ -346,7 +325,6 @@ function moduleLoadError() {
   common.logMessage('error: ' + common.naclModule.lastError);
 }
 </pre>
-</section><section id="the-readystate-attribute">
 <h2 id="the-readystate-attribute">The <code>readyState</code> attribute</h2>
 <p>You can use the <code>readyState</code> attribute to monitor the loading process. This
 attribute is particularly useful if you don&#8217;t care about the details of
@@ -413,7 +391,6 @@ the progress events are generated.</p>
   &lt;/body&gt;
 &lt;/html&gt;
 </pre>
-</section><section id="the-exitstatus-attribute">
 <h2 id="the-exitstatus-attribute">The <code>exitStatus</code> attribute</h2>
 <p>This read-only attribute is set if the application calls <code>exit(n)</code>,
 <code>abort()</code>, or crashes. Since NaCl modules are event handlers, there is no
@@ -429,6 +406,6 @@ target architecture, and may change in the future. Applications should not
 rely on the <code>exitStatus</code> value being stable in these cases, but the value
 may nevertheless be useful for temporary debugging.</li>
 </ul>
-</section></section>
+</section>
 
 {{/partials.standard_nacl_article}}