Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created October 30, 2011 15:01
Show Gist options
  • Save Raynos/1326003 to your computer and use it in GitHub Desktop.
Save Raynos/1326003 to your computer and use it in GitHub Desktop.
var punchSuper($super, klas) {
var keys = Object.keys(klas);
for (var i = 0, len = keys.length; i < len; i++) {
var val = keys[i];
if (typeof val === "function") {
val.$super = $super;
}
}
};
var Parent = {
method: function () {}
};
var Child = punchSuper(Parent, Object.make(Parent, {
method: function () {}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment