Exemplo n.º 1
0
Arquivo: spy.js Projeto: 6174/cobble
	function breadthFirstSearchObjForFunc(obj, fullname, name, parent) {
		var type = util.typeOf(obj),
			itemname, item;
		if (type === 'function') {
			spyAFunc(obj, fullname, name, parent);
		}

		if (obj && type !== 'array' && type !== 'string' && type !== 'number' && util.typeOf(obj.hasOwnProperty) === 'function') {
			for (itemname in obj) {
				if (hasOwn.call(obj, itemname)) {
					item = obj[itemname];
					// window.window === window
					// jQuery.fn.constructor === jQuery will introduce endless loop
					if (item !== obj && itemname !== 'constructor') {
						checkObj(item, fullname + '.' + itemname, itemname, obj);
					}
				}
			}
		}
	}
Exemplo n.º 2
0
Arquivo: spy.js Projeto: 6174/cobble
	function spy(arg1, namespace) {
		var type = util.typeOf(arg1);
		var ret;
		if(type == 'function'){
			var name = getFuncName(arg1);
			ret = spyAFunc(arg1, namespace? namespace + name : name, name);
		}else if(type == 'object'){
			ret = spyAObject(arg1, '');
		}else if(type == 'string'){
			return functionHashTable[arg1];
		}
		return ret;
	}