Created
November 3, 2012 11:38
-
-
Save Radagaisus/4007116 to your computer and use it in GitHub Desktop.
Hack to Access Object Literals with the Fat Arrow
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
| # A very ugly hack to access object literals | |
| # with the fat arrow: | |
| # | |
| # _this = obj = {} | |
| # | |
| # $.extend obj, | |
| # hello: => @stuff() | |
| # | |
| # compiles to: | |
| # | |
| # var obj, | |
| # _this = this; | |
| # | |
| # _this = obj; | |
| # $.extend(obj, { | |
| # hello: function() { | |
| # return _this.stuff(); | |
| # } | |
| # }); | |
| _this = obj |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment