2011-12-17 00:39:52 +00:00
|
|
|
var cah = {};
|
|
|
|
|
2012-01-28 08:49:50 +00:00
|
|
|
cah.DEBUG = false;
|
|
|
|
cah.SILENT_DEBUG = true;
|
2012-01-23 07:58:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This client's nickname.
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2011-12-23 02:48:20 +00:00
|
|
|
cah.nickname = "";
|
2012-01-18 04:36:34 +00:00
|
|
|
|
2012-01-23 07:58:36 +00:00
|
|
|
/**
|
2012-01-23 21:20:15 +00:00
|
|
|
* The games this client is playing in. Key is game id.
|
2012-01-23 07:58:36 +00:00
|
|
|
*
|
2012-01-23 21:20:15 +00:00
|
|
|
* @type {Object}
|
2012-01-23 07:58:36 +00:00
|
|
|
*/
|
2012-01-23 21:20:15 +00:00
|
|
|
cah.currentGames = {};
|
2012-01-23 07:58:36 +00:00
|
|
|
|
2012-01-18 04:36:34 +00:00
|
|
|
/**
|
|
|
|
* Binds a function to a "this object". Result is a new function that will do the right thing across
|
|
|
|
* contexts.
|
|
|
|
*
|
|
|
|
* @param {Object}
|
|
|
|
* selfObj Object for "this" when calling the returned function.
|
|
|
|
* @param {Function}
|
|
|
|
* func Function to call with selfObjc as "this".
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
cah.bind = function(selfObj, func) {
|
|
|
|
return function() {
|
|
|
|
func.apply(selfObj, arguments);
|
|
|
|
};
|
|
|
|
};
|
2012-01-20 05:19:55 +00:00
|
|
|
|
|
|
|
/**
|
2012-01-22 01:34:18 +00:00
|
|
|
* Inherit the proto methods from one constructor to another.
|
2012-01-20 05:19:55 +00:00
|
|
|
*
|
|
|
|
* @param {Function}
|
|
|
|
* childCtor Child class.
|
|
|
|
* @param {Function}
|
|
|
|
* parentCtor Parent class.
|
|
|
|
*/
|
|
|
|
cah.inherits = function(childCtor, parentCtor) {
|
|
|
|
/** @constructor */
|
|
|
|
function tempCtor() {
|
|
|
|
// pass
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
tempCtor.prototype = parentCtor.prototype;
|
|
|
|
childCtor.superClass_ = parentCtor.prototype;
|
|
|
|
childCtor.prototype = new tempCtor();
|
|
|
|
childCtor.prototype.constructor = childCtor;
|
|
|
|
};
|