I'm writing a NSWindowController subclass and I was wondering what
would be the best way of expressing the above idiom within JSCocoa.
Would this = this.Super(arguments); work?
Almost, as you can't assign to this in Javascript. Use another variable :
class MyWindowController < NSWindowController
{
- (id)init
{
var obj = this.Super(arguments)
obj.myValue = ...
obj.myMethod(..., ...)
return obj
}
}
-Patrick
> Almost, as you can't assign to this in Javascript. Use another variable :
>
> class MyWindowController < NSWindowController
> {
> - (id)init
> {
> var obj = this.Super(arguments)
Thanks! One more question:
How do I reference the superclass in order to invoke arbitrary method
on it, something like
...
-(id)foo {
this.super.bar(arguments);
}
Esad
You can't, I'll have to add it.
-Patrick
You can now do this via the ObjJ syntax :
- (id)foo {
[super someMethodWithArgument1:… andArgument2:…]
}
http://github.com/parmanoir/jscocoa/blob/master/Tests/47%20ObjJ%20syntax%20super.js
-Patrick