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
<?xml version='1.0'?> | |
<!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd"> | |
<signatures version='1.0'> | |
<depends_on path='/System/Library/Frameworks/Accelerate.framework'/> | |
<struct name='AUNodeConnection' type='{AudioUnitNodeConnection="sourceNode"i"sourceOutputNumber"I"destNode"i"destInputNumber"I}'/> | |
<struct name='AUNodeInteraction' type='{AUNodeInteraction="nodeInteractionType"I"nodeInteraction"(?="connection"{AudioUnitNodeConnection="sourceNode"i"sourceOutputNumber"I"destNode"i"destInputNumber"I}"inputCallback"{AUNodeRenderCallback="destNode"i"destInputNumber"I"cback"{AURenderCallbackStruct="inputProc"^?"inputProcRefCon"^v}})}'/> | |
<struct name='AUNodeRenderCallback' type='{AUNodeRenderCallback="destNode"i"destInputNumber"I"cback"{AURenderCallbackStruct="inputProc"^?&quo |
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
module.exports = function (a, b) { | |
return a + b | |
} |
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('./') | |
$.import('Foundation') | |
$.import('Cocoa') | |
var pool = $.NSAutoreleasePool('alloc')('init') | |
var app = $.NSApplication('sharedApplication') | |
var style = $.NSClosableWindowMask | $.NSResizableWindowMask | |
| $.NSTexturedBackgroundWindowMask | $.NSTitledWindowMask | |
| $.NSMiniaturizableWindowMask |
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
// This example adapted from Matt Gallagher's "Minimalist Cocoa Programming" | |
// blog article: | |
// http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html | |
var $ = require('NodObjC') | |
$.import('Cocoa') | |
var pool = $.NSAutoreleasePool('alloc')('init') | |
, app = $.NSApplication('sharedApplication') |
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
Handle<Value> Pointer::PutObject(const Arguments& args) | |
{ | |
HandleScope scope; | |
Pointer *self = ObjectWrap::Unwrap<Pointer>(args.This()); | |
unsigned char *ptr = self->GetPointer(); | |
if (args.Length() >= 1) { | |
Local<Value> obj = args[0]; | |
*((unsigned char **)ptr) = reinterpret_cast<unsigned char*>(new Persistent<Value>(obj)); | |
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 ffi = require('./') | |
, assert = require('assert') | |
var p = new ffi.Pointer(1024) | |
, orig = p.seek(0) | |
var put1 = { test: { equality: true } } | |
, put2 = { test2: 'does this work?' } | |
p.putObject(put1, true) |
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') | |
$.import('Foundation') | |
var pool = $.NSAutoreleasePool('alloc')('init') | |
var pi = $.NSProcessInfo('processInfo') | |
// Initial | |
console.log('Initial:') | |
console.log('process.title: %s', process.title) | |
console.log('pi("processName"): %s', pi('processName')) |
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') | |
, ffi = require('node-ffi') | |
$.import('MobileDevice') | |
function callback (info, foo) { | |
console.log('inside callback!') | |
} | |
// Get a function pointer to the callback function above |
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 weak = require('weak') | |
// This is our weakmap; a regular JS Object | |
var map = {} | |
// This is the object we wanna store a weak reference to | |
var anObj = { foo: 'bar' } | |
, key = 'anObj' | |
// Create a weak reference and store it in the map. |
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') | |
$.import('MobileDevice'); | |
$.import('CoreFoundation') | |
// Callback function that's invoked when a device is plugged in | |
function callback (info, foo) { | |
try { | |
console.log('inside callback!') | |
var i = new $.am_device_notification_callback_info(info) |