Make compatible with jQuery. Slight API change.

Rename the $() selector to $D() so that it doesn't collide with
the jQuery name.

The API change is that the 'target' option for Canvas and RFB objects
must now be a DOM Canvas element. A string is no longer accepted
because this requires that a DOM lookup is done and the Canvas and RFB
should have no UI code in them. Modularity.
This commit is contained in:
Joel Martin
2010-12-10 08:25:36 -06:00
parent 5b0bbd5c12
commit e46719100c
13 changed files with 115 additions and 110 deletions
+10 -10
View File
@@ -40,7 +40,7 @@
function message(str) {
console.log(str);
cell = $('messages');
cell = $D('messages');
cell.innerHTML += msg_cnt + ": " + str + "\n";
cell.scrollTop = cell.scrollHeight;
msg_cnt += 1;
@@ -80,10 +80,10 @@
}
function begin () {
$('startButton').value = "Running";
$('startButton').disabled = true;
$D('startButton').value = "Running";
$D('startButton').disabled = true;
setTimeout(start_delayed, 250);
iterations = $('iterations').value;
iterations = $D('iterations').value;
}
function start_delayed () {
@@ -109,14 +109,14 @@
canvas.resize(start_width, start_height, true);
test_functions();
}
$('startButton').disabled = false;
$('startButton').value = "Do Performance Test";
$D('startButton').disabled = false;
$D('startButton').value = "Do Performance Test";
}
function run_test () {
var width, height;
width = $('width').value;
height = $('height').value;
width = $D('width').value;
height = $D('height').value;
canvas.resize(width, height);
var color, start_time = (new Date()).getTime(), w, h;
for (var i=0; i < iterations; i++) {
@@ -137,8 +137,8 @@
window.onload = function() {
message("in onload");
$('iterations').value = 10;
canvas = Canvas({'target' : 'canvas'});
$D('iterations').value = 10;
canvas = new Canvas({'target' : $D('canvas')});
canvas.resize(start_width, start_height, true);
message("Canvas initialized");
test_functions();