jquery.jsonengine.js 書き始めた

jsonengineをシンプルに扱うことの出来るjQueryプラグインを書いたんだけど公開するかはまだ迷い中。ホンのちょっとだけ便利かなーと。こんな感じで書けます。

jquery.jsonengine.js のサンプル

$(function() {

//スタイル1:デフォルトのdocTypeを指定しパラメータをオブジェクトリテラルで渡す。updateは必ず_checkUpdatesAfterが付く。

	$.je.docType('tasks');

	$.je.create({"foo":"bar"}, function(response, status){
		// do something with task here
	});

	$.je.read({"foo":".eq.bar"}, function(response, status){
		// do something with task here
	});

	$.je.update({"foo":"bar","_docId":"00roxf3RwEBi1ZobhYECZdUnT766oU97"}, function(response, status){
		// do something with task here
	});

	$.je.destroy({"_docId":"00roxf3RwEBi1ZobhYECZdUnT766oU97"}, function(response, status){
		// do something with task here
	});

//スタイル2:実行毎にdocTypeを指定しパラメータをオブジェクトリテラルで渡す

	$.je.post('tasks', {"foo":"bar"}, function(response, status){}, function(xhr, status, errorThrown){});

	$.je.get('tasks', {"foo":".eq.bar"}, function(response, status){}, function(xhr, status, errorThrown){});

	$.je.put('tasks', {"foo":"bar","_docId":"00roxf3RwEBi1ZobhYECZdUnT766oU97"}, function(response, status){}, function(xhr, status, errorThrown){});

	$.je.del('tasks', {"_docId":"00roxf3RwEBi1ZobhYECZdUnT766oU97"}, function(response, status){}, function(xhr, status, errorThrown){});

//スタイル3:パラメータを全て文字列で定義して実行する

	$.je.put('/tasks?foo=bar', function(response, status){}, function(xhr, status, errorThrown){});

	$.je.get('/tasks/00roxf3RwEBi1ZobhYECZdUnT766oU97', function(response, status){}, function(xhr, status, errorThrown){});

	$.je.get('/tasks?cond=foo.eq.bar', function(response, status){}, function(xhr, status, errorThrown){});

	$.je.put('/tasks?foo=bar?_docId=00roxf3RwEBi1ZobhYECZdUnT766oU97', function(response, status){}, function(xhr, status, errorThrown){});

	$.je.del('/tasks/00roxf3RwEBi1ZobhYECZdUnT766oU97', function(response, status){}, function(xhr, status, errorThrown){});

});

最初はslim3のDataStoreっぽくチェーンメソッドで組み立てる形式で書いたけどIDEやらの支援機能が使えなくてあんまり意味ないかなってこっちの書き方に直した。これならjQuery知ってる人だと一目で使い方が分かってもらえるんじゃないかと。もっと汎用的なRESTFullプラグインがいいかな?ご意見お聞かせください。