Skip to content

Instantly share code, notes, and snippets.

@tal
Created January 18, 2012 19:28
Show Gist options
  • Save tal/1635047 to your computer and use it in GitHub Desktop.
Save tal/1635047 to your computer and use it in GitHub Desktop.
Changing the way to define classes in js
GC.util.classSetup('GC.Page.Klass', function() {
return {
val1: val1,
val2: val2
}
});
GC || (GC = {});
GC.Page || (GC.Page = {});
GC.Page.Klass = (function() {
return {
val1: val1,
val2: val2
}
})();
GC.util.classSetup('GC.Page', function() {
return {
val1: val1
}
});
// Will safely create or merge with existing GC.Page
GC || (GC = {});
GC.Page = (function() {
return {
val1: val1
}
})();
// Will override must be run before klass.old.js or shit will get overridden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment