GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
I think it can be usefull to be able to asynchronously call the parent method easily.
Added a way to get the parent function for using it as a callback
i ran test successfully btw
any news for this commit ?
@cpojer @ibolmo @arian you guys might want to take a look at this and chime in.
The example you provided is contrived. ... I don't understand the application of what you're adding.
He wants to be able to pass a pointer to the parent version of a function to as an argument to another method. Agreed, it's contrived. I'm inclined to say that it's ill-advised, but thought you guys might want to see it first.
fwiw this is possible in ES6: http://google.github.io/traceur-compiler/demo/repl.html#class%20A%20%7B%0A%20%20constructor()%20%7B%0A%20%20%20%20this.prop%20%3D%20123%3B%20%0A%20%20%7D%0A%20%20method(a)%20%7B%0A%20%20%20%20console.log(a%2C%20this.prop)%3B%20%0A%20%20%7D%0A%7D%0A%0Aclass%20B%20extends%20A%20%7B%0A%20%0A%20%20methodB()%20%7B%0A%20%20%20%20this.callMethod(super.method)%3B%0A%20%20%7D%0A%20%20%0A%20%20callMethod(fn)%20%7B%0A%20%20%09fn.call(this%2C%20'Hi!')%3B%0A%20%20%7D%0A%20%20%0A%7D%0A%0A(new%20B).methodB()%3B
Personally I think this pattern isn't awesome and I consider all of Core to be in complete feature-freeze so I'd advise against introducing new API. Also, getParent is a bad name and might conflict with user-code.
I'm generally in agreement here. Closing pull.