Created
April 11, 2013 18:17
-
-
Save psema4/5365829 to your computer and use it in GitHub Desktop.
ES6 Classes Polyfill (via public-webapps, A Wirfs-Brock)
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
// ES6 | |
class Sub extends Super { | |
constructor() {/*constructor body */ } | |
method1 () {} | |
static method2 {} | |
} | |
// ES3/5 | |
function Sub() {/*constructor body */ } | |
Sub.__proto__ = Super; | |
Sub.prototype = Object.create(Super.prototype); | |
Sub.prototype.method1 = function method1() {}; | |
Sub.method2 = function method2 () {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment