Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: experimental/webgtt/javascript/webgtt.js

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « experimental/webgtt/javascript/vertex.js ('k') | experimental/webgtt/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be found
3 // in the LICENSE file.
4
5 /**
6 * @fileoverview This file contains the top level JavaScript required for the
7 * WebGTT application. The two main functions are fired when the page loads and
8 * when the NaCl module loads, respectively. We handle these load events
9 * separately since the order in which these events are fired is much less
10 * predictable than other standard DOM elements (for which we assume that they
11 * are loaded when the page is loaded).
12 *
13 * @author ragad@google.com (Raga Gopalakrishnan)
14 */
15
16 /**
17 * Each of these variables is an object corresponding to a DOM element. Since
18 * event handlers for one DOM element may need to modify properties of or
19 * perform actions on another DOM element, these objects have global scope.
20 */
21 var naclModule1 = undefined; // NaClModule object. See naclmodule.js
22 var graph1 = new Graph(); // Graph object. See graph.js
23 var canvas1 = undefined; // Canvas object. See canvas.js
24 var coloringButton1 = undefined; // ColoringButton object. See button.js
25
26 /**
27 * This constant holds the default status message.
28 * @type {string}
29 * @const
30 */
31 STATUS_TEXT = 'NO-STATUS';
32
33 /**
34 * This function is triggered when the page has finished loading, and contains
35 * starter code (initializing objects, etc.).
36 *
37 * The NaCl module could still be loading while the page has finished loading.
38 * So, the status must be updated accordingly, and no NaClModule object is
39 * created yet. New objects of the Canvas and ColoringButton classes are
40 * created, and the appropriate event handlers are attached.
41 */
42 function main1 () {
43 if (naclModule1 == undefined) {
44 updateStatus('LOADING...');
45 } else {
46 updateStatus();
47 }
48
49 canvas1 = new Canvas(document.getElementById('mainCanvas'), graph1);
50 canvas1.drawingCanvas.addEventListener(
51 'click', function (e) {canvas1.handleCanvasClick(e);}, false);
52 window.addEventListener(
53 'keydown', function (e) {canvas1.handleCanvasKeydown(e);}, true);
54
55 coloringButton1 = new ColoringButton(document.getElementById('coloring'),
56 graph1);
57 coloringButton1.coloringButton.addEventListener(
58 'click', function (e) {coloringButton1.handleColoringButtonClick(e);},
59 false);
60 }
61
62 /**
63 * This function is triggered when the NaCl module has finished loading. It
64 * creates a new NaClModule object, attaches an event handler to it, and
65 * indcates to the user that the NaCl module has loaded successfully.
66 */
67 function main2() {
68 naclModule1 = new NaClModule(document.getElementById('webgtt'), graph1);
69 naclModule1.naclModule.addEventListener(
70 'message', function (e) {naclModule1.handleMessage(e);}, false);
71 updateStatus('SUCCESS');
72 }
73
74 /**
75 * This function sets the global status message.
76 *
77 * If the element with id 'statusField' exists, then its HTML is set to the
78 * status message as well. opt_message is the message text. If this is null or
79 * undefined, then the element with id 'statusField' is set to STATUS_TEXT.
80 *
81 * @param {string} opt_message The status message to be displayed.
82 */
83 function updateStatus(opt_message) {
84 var statusText = STATUS_TEXT;
85 if (opt_message) {
86 statusText = opt_message;
87 }
88 var statusField = document.getElementById('status_field');
89 if (statusField) {
90 statusField.innerHTML = statusText;
91 }
92 }
OLDNEW
« no previous file with comments | « experimental/webgtt/javascript/vertex.js ('k') | experimental/webgtt/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698