changelog shortlog tags manifest raw

changeset: jpoker.table.clear/setTimeout

changeset 756: 0e2ba92c093a
parent 755:098397297de8
child 757:26c2a433710b
child 758:d456cacb047e
author: root@kun
date: Mon Aug 25 16:54:18 2008 +0000 (2 months ago)
files: jpoker/js/jquery.jpoker.js jpoker/js/test-jpoker.js
description: jpoker.table.clear/setTimeout
--- a/jpoker/js/jquery.jpoker.js	Mon Aug 25 16:40:33 2008 +0000
+++ b/jpoker/js/jquery.jpoker.js	Mon Aug 25 16:54:18 2008 +0000
@@ -1399,17 +1399,20 @@
                 this.dealer = -1;
                 this.position = -1;
                 this.state = 'end';
-		jpoker.getServer(this.url).clearTimeout(this.pollTimer);
+		this.clearTimeout(this.pollTimer);
 		this.pollTimer = -1;
 		this.pollFrequency = 1000;
             },
+
+            clearTimeout: function(id) { return window.clearTimeout(id); },
+            setTimeout: function(cb, delay) { return window.setTimeout(cb, delay); },
 
 	    poll: function() {
 		var server = jpoker.getServer(this.url);
 		server.sendPacket({type: 'PacketPokerPoll',
 			    game_id: this.game_id});
 		var $this  = this;
-		this.pollTimer = server.setTimeout(function() {
+		this.pollTimer = this.setTimeout(function() {
 			$this.poll();
 		    }, this.pollFrequency);
 	    },
--- a/jpoker/js/test-jpoker.js	Mon Aug 25 16:40:33 2008 +0000
+++ b/jpoker/js/test-jpoker.js	Mon Aug 25 16:54:18 2008 +0000
@@ -1668,7 +1668,7 @@
 	    equals(packet.type, "PacketPokerPoll");
 	};
 	var callback;
-	server.setTimeout = function(f) {
+	jpoker.table.prototype.setTimeout = function(f) {
 	    callback = f;
 	    return 42;
 	};
@@ -1676,7 +1676,7 @@
 	table.poll();
 	equals(table.pollTimer, 42, 'pollTimer set');
 
-	server.clearTimeout = function(timer) {
+	jpoker.table.prototype.clearTimeout = function(timer) {
 	    equals(timer, 42, "clearTimeout called by poll")
 	};
 	callback();
@@ -1686,12 +1686,11 @@
 	};
 	callback();
 
-	server.clearTimeout = function(timer) {
+	jpoker.table.prototype.clearTimeout = function(timer) {
 	    ok(true, "clearTimeout called by uninit")
 	};
 	table.uninit();
 	equals(table.pollTimer, -1, 'pollTimer cleared by uninit');
-	server.clearTimeout = function() {};
 	cleanup();
     });