Permalink
Browse files

* Use "extends" rather than "<<<<" for inheritance.

  (As suggested by @gkz ++)
  • Loading branch information...
1 parent 92d598f commit 11aa2a8b3b57b0b98a6f21d03eeb47563cdca9d9 @audreyt committed Jun 11, 2012
Showing with 9 additions and 10 deletions.
  1. +8 −7 jscex-jquery.js
  2. +1 −3 src/jscex-jquery.ls
View
@@ -38,9 +38,9 @@
});
};
/* Our own monad that runs on $.Deferred instead of Task */
- AsyncBuilder = (function(){
+ AsyncBuilder = (function(superclass){
AsyncBuilder.displayName = 'AsyncBuilder';
- var prototype = AsyncBuilder.prototype, constructor = AsyncBuilder;
+ var prototype = __extend(AsyncBuilder, superclass).prototype, constructor = AsyncBuilder;
prototype.Start = function(_this, step){
var __;
__ = $.Deferred();
@@ -78,8 +78,7 @@
};
function AsyncBuilder(){}
return AsyncBuilder;
- }());
- __importAll(AsyncBuilder.prototype, Jscex.BuilderBase.prototype);
+ }(Jscex.BuilderBase));
Jscex.binders['async-jquery'] = '$await';
Jscex.builders['async-jquery'] = new AsyncBuilder;
Jscex.modules['async-jquery'] = true;
@@ -103,8 +102,10 @@
Jscex.logger.level = 999;
/* Export the $ object extended with $.Jscex */
$.Jscex = Jscex;
- function __importAll(obj, src){
- for (var key in src) obj[key] = src[key];
- return obj;
+ function __extend(sub, sup){
+ function fun(){} fun.prototype = (sub.superclass = sup).prototype;
+ (sub.prototype = new fun).constructor = sub;
+ if (typeof sup.extended == 'function') sup.extended(sub);
+ return sub;
}
}).call(this);
View
@@ -20,7 +20,7 @@ Jscex.Async.@Binding.fromPromise = (p) ->
return t
/* Our own monad that runs on $.Deferred instead of Task */
-class AsyncBuilder
+class AsyncBuilder extends Jscex.BuilderBase
Start: (_this, step) ->
__ = $.Deferred!
step.next _this, !(type, value, target) ->
@@ -38,8 +38,6 @@ class AsyncBuilder
!(error) -> cb \throw, error
)
-AsyncBuilder:: <<<< Jscex.BuilderBase::
-
Jscex.binders.\async-jquery = \$await
Jscex.builders.\async-jquery = new AsyncBuilder
Jscex.modules.\async-jquery = true

0 comments on commit 11aa2a8

Please sign in to comment.