2008年 01月 18日

GreaseMonkey の GM_xmlhttpRequest を順番に(略)

http://d.hatena.ne.jp/drgqst/20080110/1199976698

JSDeferred だとこんな感じかなぁ

	function parseJSON (d) {
		// unsafe
		return eval("("+d.responseText+")");
	}

	next(function () {
		return xhttp.get("http://twitter.com/statuses/public_timeline.json").next(parseJSON);
	}).
	next(function (d) {
		var id = d[0].user.screen_name;
		GM_log(id);
		return xhttp.get("http://twitter.com/users/show/" + id + ".json").next(parseJSON);
	}).
	next(function (d) {
		GM_log(uneval(d));
	}).
	error(function (e) {
		alert(e);
	});