Created
March 7, 2013 09:12
-
-
Save chakrit/5106658 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated by CoffeeScript 1.5.0 | |
(function() { | |
var Base, outsideMethod, | |
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | |
outsideMethod = function(func) { | |
return func.call({ | |
message: 'wrong!' | |
}); | |
}; | |
Base = (function() { | |
function Base() { | |
this.echo = __bind(this.echo, this); this.message = 'right!'; | |
outsideMethod(this.echo); | |
} | |
Base.prototype.echo = function() { | |
return console.log(this.message); | |
}; | |
return Base; | |
})(); | |
new Base; | |
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated by CoffeeScript 1.6.1 | |
(function() { | |
var Base, outsideMethod, | |
_this = this; | |
outsideMethod = function(func) { | |
return func.call({ | |
message: 'wrong!' | |
}); | |
}; | |
Base = (function() { | |
function Base() { | |
var _this = this; | |
this.message = 'right!'; | |
outsideMethod(this.echo); | |
this.echo = function() { | |
return Base.prototype.echo.apply(_this, arguments); | |
}; | |
} | |
Base.prototype.echo = function() { | |
return console.log(this.message); | |
}; | |
return Base; | |
})(); | |
new Base; | |
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
outsideMethod = (func) -> | |
func.call message: 'wrong!' | |
class Base | |
constructor: -> | |
@message = 'right!' | |
outsideMethod @echo | |
echo: => | |
console.log @message | |
new Base |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment