Created
May 18, 2012 10:30
-
-
Save robkuz/2724548 to your computer and use it in GitHub Desktop.
easy adhoc package and dependency system using Coffeescripts destructuring assignment
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 A | |
| class B | |
| # packages and their artifacts must be defined as object literals | |
| window.foobaz = { | |
| A | |
| B | |
| } |
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
| # this solely introduces a "imports" keyword to make it more explicit | |
| # that we want to "load" artifacts from other files. | |
| # All of this could be done by using the destructering assignments of | |
| # coffeescript without introducing a keyword | |
| window.imports = (map) -> map |
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, B} = imports foobaz | |
| a = new A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment