Skip to content
Browse files

わすれてた

  • Loading branch information...
1 parent 5fead94 commit 9e18cd35190dab224b310cd8fea62860f78d8816 @cho45 committed
Showing with 95 additions and 23 deletions.
  1. +30 −1 README.markdown
  2. +15 −0 Rakefile
  3. +26 −22 package.json
  4. +24 −0 package.json.tmpl
View
31 README.markdown
@@ -189,7 +189,7 @@ After the process, above code is same as following:
### Error processing and recovering ###
-A Deferred has also error-back for error processing. Let's just see a example (from test):
+A Deferred has also error-back for error processing. Let's just see an example (this is from test):
next(function () {
throw "Error";
@@ -215,9 +215,38 @@ The error thrown in callback is propagated by error-back chain. If the error-bac
### Difference between MochiKit and JSDeferred ###
+JSDeferred is inspired by MochiKit Deferred object, so both is similar but JSDeferred drops some functions and simplified it.
+
* MochiKit Deferred has chain by Array. JSDeferred has chain by chain of Deferred.
* MochiKit Deferred separates parent chain and child chain, JSDeferred not.
+## Comparison of other deferred-like objects ##
+
+### vs [jQuery's Deferred]( http://api.jquery.com/category/deferred-object/ )
+
+ * Bad: Not supports child deferred
+ * Bad: No utility functions
+ * Good: Simple
+ * Good: Cache result (it can be called after completed the task)
+ * Good: jQuery embed (no more dependencies and compact)
+
+### vs [Dojo's Deferred]( http://docs.dojocampus.org/dojo/Deferred )
+
+ * Bad: Not supports child deferred
+ * Bad: Very heavy dependencies for dojo
+ * Good: Support progress
+
+### vs [CommonJS's Promise]( http://wiki.commonjs.org/wiki/Promises )
+
+ * Bad: Not implemeneted?
+ * Bad: Not supports child deferred
+ * Bad: Too complex
+ * Good: Highlier functional
+
+## Different-origin Deferred instances
+
+JSDeferred can be used in inter-environment which is independent respectively like browser extension
+because JSDeferred determines a self-class identity by instance id.
Author
-------
View
15 Rakefile
@@ -122,6 +122,21 @@ task :release => [:update, :clean, :test] do
sh %|git push --tags|
end
+task :npm => [:clean, :test] do
+ require 'json'
+ data = JSON.parse(File.read('package.json.tmpl'))
+ data['version'] = Version
+ File.open("package.json", "w") do |f|
+ f.puts JSON.pretty_generate(data)
+ end
+ puts File.read("package.json")
+ print "Sure publishing to npm repository? [yN]: "
+ if $stdin.gets =~ /y/i
+ puts "publishing..."
+# # sh %{npm publish .}
+ end
+end
+
desc "Create Documentation"
task :doc => ["doc/index.html"] do |t|
end
View
48 package.json
@@ -1,24 +1,28 @@
-{ "name" : "jsdeferred"
-, "description" : "Asynchronous library in JavaScript. Standalone and Compact."
-, "version" : "0.3.4"
-, "homepage" : "http://github.com/cho45/jsdeferred"
-, "author" : "cho45 <cho45@lowreal.net> (http://www.lowreal.net/)"
-, "repository" :
- { "type" : "git"
- , "url" : "git://github.com/cho45/jsdeferred.git"
- }
-, "bugs" :
- { "mail" : "cho45@lowreal.net"
- , "web" : "http://github.com/cho45/jsdeferred/issues"
- }
-, "modules" :
- { "jsdeferred" : "./jsdeferred.js"
- }
-, "directories" : { "doc" : "./doc" }
-, "main" : "jsdeferred"
-, "licenses" :
- [ { "type" : "MIT"
- , "url" : "http://github.com/cho45/jsdeferred/blob/master/jsdeferred.js"
+{
+ "modules": {
+ "jsdeferred": ".\/jsdeferred.js"
+ },
+ "name": "jsdeferred",
+ "repository": {
+ "url": "git:\/\/github.com\/cho45\/jsdeferred.git",
+ "type": "git"
+ },
+ "directories": {
+ "doc": ".\/doc"
+ },
+ "author": "cho45 <cho45@lowreal.net> (http:\/\/www.lowreal.net\/)",
+ "version": "0.4.0",
+ "licenses": [
+ {
+ "url": "http:\/\/github.com\/cho45\/jsdeferred\/blob\/master\/jsdeferred.js",
+ "type": "MIT"
}
- ]
+ ],
+ "main": "jsdeferred",
+ "homepage": "http:\/\/github.com\/cho45\/jsdeferred",
+ "description": "Asynchronous library in JavaScript. Standalone and Compact.",
+ "bugs": {
+ "mail": "cho45@lowreal.net",
+ "web": "http:\/\/github.com\/cho45\/jsdeferred\/issues"
+ }
}
View
24 package.json.tmpl
@@ -0,0 +1,24 @@
+{ "name" : "jsdeferred"
+, "description" : "Asynchronous library in JavaScript. Standalone and Compact."
+, "version" : null
+, "homepage" : "http://github.com/cho45/jsdeferred"
+, "author" : "cho45 <cho45@lowreal.net> (http://www.lowreal.net/)"
+, "repository" :
+ { "type" : "git"
+ , "url" : "git://github.com/cho45/jsdeferred.git"
+ }
+, "bugs" :
+ { "mail" : "cho45@lowreal.net"
+ , "web" : "http://github.com/cho45/jsdeferred/issues"
+ }
+, "modules" :
+ { "jsdeferred" : "./jsdeferred.js"
+ }
+, "directories" : { "doc" : "./doc" }
+, "main" : "jsdeferred"
+, "licenses" :
+ [ { "type" : "MIT"
+ , "url" : "http://github.com/cho45/jsdeferred/blob/master/jsdeferred.js"
+ }
+ ]
+}

0 comments on commit 9e18cd3

Please sign in to comment.
Something went wrong with that request. Please try again.