Created
December 11, 2012 22:20
-
-
Save esmevane/4262853 to your computer and use it in GitHub Desktop.
CoffeeScript to JS closure and context demonstration
This file contains hidden or 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
class @Beany extends Array | |
constructor: (@souffle = true) -> console.log @souffle | |
beany = new Beany |
This file contains hidden or 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.4.0 | |
(function() { | |
var beany, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
this.Beany = (function(_super) { | |
__extends(Beany, _super); | |
function Beany(souffle) { | |
this.souffle = souffle != null ? souffle : true; | |
console.log(this.souffle); | |
} | |
return Beany; | |
})(Array); | |
beany = new Beany; | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment