Created
June 4, 2014 20:49
-
-
Save thomaswrenn/3ee047540e083c20becb to your computer and use it in GitHub Desktop.
NodObjC Block Experiments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment