Skip to content

Instantly share code, notes, and snippets.

@robkuz
Created May 18, 2012 10:30
Show Gist options
  • Select an option

  • Save robkuz/2724548 to your computer and use it in GitHub Desktop.

Select an option

Save robkuz/2724548 to your computer and use it in GitHub Desktop.
easy adhoc package and dependency system using Coffeescripts destructuring assignment
class A
class B
# packages and their artifacts must be defined as object literals
window.foobaz = {
A
B
}
# 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
{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