-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can NodObjC Handle the Event Type? #32
Comments
@matt- Your example doesn't quite match up with the python one above (although I don't know python, they're doing two different things). The Python example extends the NSApplication and overrides its sendEvent method (or, at least, appears to). While the nodobjc example you have creates a delegate and assigns the delegate to the application. Delegates are not the same as extending (and overriding) a method in an existing object. What you'd probably want to do is: $.NSApplication.extend('KeySocketApp');
$.KeySocketApp ... // and so on... Delegates are just an object that NSApplication can ask questions about how it should function (what you implemented). However extending and overriding a method is taking the existing Class/Object and overriding its behavior to do something new. It's generally regarded (especially on NSApplication, a very core class/object) as a bad idea, but can be very powerful if you're careful. Good luck! |
Not a bug, don't hate me for closing it :) |
Oops, no hate! Sorry for not closing this myself I was able to resolve my issue with the following: var $ = require('NodObjC');
$.framework('AppKit');
var app = $.NSApplication.extend('KeyApp');
app.addMethod('sendEvent:','v@:@', function(self, _cmd, nsevent){
console.log(nsevent);
});
app.register();
app('sharedApplication')('run'); |
I am trying to duplicate the following python:
So far I have the following JS:
The text was updated successfully, but these errors were encountered: