ES6 class methods do not show up when extending Function


#1

I was doing some metaprogramming and found that if you extended ‘Function’ in an ES6 class, it didn’t add the new class methods. This works in a chrome browser, but doesn’t work on Meteor 1.3.4.1 server code, I’m using the default packages.

        class Tester extends Function {
            constructor(){ super() }
            test(){}
        }

        a = new Tester;
        console.log(a.apply); //Shows up in chrome and meteor server.
        console.log(a.test); //Show up in chrome, is undefined in meteor server.

Does anyone have any idea whats going on?


#2

I can confirm your findings, but don’t have an explanation. Can you do this “old-school” with prototype?