Skip to content

Instantly share code, notes, and snippets.

@thomaswrenn
Last active August 29, 2015 14:02
Show Gist options
  • Save thomaswrenn/3b3981de517cf49cd915 to your computer and use it in GitHub Desktop.
Save thomaswrenn/3b3981de517cf49cd915 to your computer and use it in GitHub Desktop.
NodObjCBlockExperiments
var $ = require('NodObjC');
var types = require('./node_modules/NodObjC/lib/types')
, SEL = require('./node_modules/NodObjC/lib/sel')
, id = require('./node_modules/NodObjC/lib/id')
, Class = require('./node_modules/NodObjC/lib/class')
, IMP = require('./node_modules/NodObjC/lib/imp')
, block = require('./node_modules/NodObjC/lib/block')
$.import('Foundation');
$.import('Cocoa');
var app = $.NSApplication('sharedApplication');
var style = $.NS
// [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask
// handler:^(NSEvent *event){
// [r respondToClick:event];
// }];
var pool = $.NSAutoreleasePool('alloc')('init');
$.NSEvent
('addGlobalMonitorForEventsMatchingMask',
$.NSLeftMouseDownMask,
'handler',
block.createBlock(function(self, __cmd, event){
console.log(event);
}, "v@:@")
);
// set up the app delegate
// var AppDelegate = $.NSObject.extend('AppDelegate')
// AppDelegate.addMethod('applicationDidFinishLaunching:', 'v@:@', function (self, _cmd, notif) {
// console.log('got applicationDidFinishLauching')
// console.log(notif)
// })
// AppDelegate.register()
// var delegate = AppDelegate('alloc')('init')
// app('setDelegate', delegate)
// app('activateIgnoringOtherApps', true)
// app('run')
pool('drain');
<NSMethodSignature: 0x1003003f0>
number of arguments = 2
frame size = 224
is special struct return? NO
return value: -------- -------- -------- --------
type encoding (v) 'v'
flags {}
modifiers {}
frame {offset = 0, offset adjust = 0, size = 0, size adjust = 0}
memory {offset = 0, size = 0}
argument 0: -------- -------- -------- --------
type encoding (@) '@?'
flags {isObject, isBlock}
modifiers {}
frame {offset = 0, offset adjust = 0, size = 8, size adjust = 0}
memory {offset = 0, size = 8}
argument 1: -------- -------- -------- --------
type encoding (@) '@"NSEvent"'
flags {isObject}
modifiers {}
frame {offset = 8, offset adjust = 0, size = 8, size adjust = 0}
memory {offset = 0, size = 8}
class 'NSEvent'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment