Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
Use MakeCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoopa committed Feb 14, 2014
1 parent aa674f8 commit 111b14b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions binding.cc
Expand Up @@ -340,7 +340,7 @@ namespace zmq {


TryCatch try_catch; TryCatch try_catch;


callback_v.As<Function>()->Call(NanObjectWrapHandle(this), 0, NULL); MakeCallback(NanObjectWrapHandle(this), callback_v.As<Function>(), 0, NULL);


if (try_catch.HasCaught()) { if (try_catch.HasCaught()) {
FatalException(try_catch); FatalException(try_catch);
Expand Down Expand Up @@ -373,7 +373,7 @@ namespace zmq {


TryCatch try_catch; TryCatch try_catch;


callback_v.As<Function>()->Call(NanObjectWrapHandle(this), 3, argv); MakeCallback(NanObjectWrapHandle(this), callback_v.As<Function>(), 3, argv);


if (try_catch.HasCaught()) { if (try_catch.HasCaught()) {
FatalException(try_catch); FatalException(try_catch);
Expand Down Expand Up @@ -663,7 +663,7 @@ namespace zmq {
socket->endpoints += 1; socket->endpoints += 1;


TryCatch try_catch; TryCatch try_catch;
cb->Call(v8::Context::GetCurrent()->Global(), 1, argv); MakeCallback(v8::Context::GetCurrent()->Global(), cb, 1, argv);
if (try_catch.HasCaught()) FatalException(try_catch); if (try_catch.HasCaught()) FatalException(try_catch);


delete state; delete state;
Expand Down Expand Up @@ -740,7 +740,7 @@ namespace zmq {
socket->Unref(); socket->Unref();


TryCatch try_catch; TryCatch try_catch;
cb->Call(v8::Context::GetCurrent()->Global(), 1, argv); MakeCallback(v8::Context::GetCurrent()->Global(), cb, 1, argv);
if (try_catch.HasCaught()) FatalException(try_catch); if (try_catch.HasCaught()) FatalException(try_catch);


delete state; delete state;
Expand Down
6 changes: 2 additions & 4 deletions lib/index.js
Expand Up @@ -2,8 +2,6 @@
* Module dependencies. * Module dependencies.
*/ */


require('set-immediate');

var EventEmitter = require('events').EventEmitter var EventEmitter = require('events').EventEmitter
, zmq = require('bindings')('zmq.node') , zmq = require('bindings')('zmq.node')
, util = require('util'); , util = require('util');
Expand Down Expand Up @@ -185,7 +183,7 @@ function Socket(type) {
EventEmitter.call(this); EventEmitter.call(this);
this.type = type; this.type = type;
this._zmq = new zmq.Socket(defaultContext(), types[type]); this._zmq = new zmq.Socket(defaultContext(), types[type]);
this._zmq.onReady = setImmediate.bind(null, this._flush.bind(this)); this._zmq.onReady = this._flush.bind(this);
this._outgoing = []; this._outgoing = [];
this._shouldFlush = true; this._shouldFlush = true;
}; };
Expand Down Expand Up @@ -470,7 +468,7 @@ Socket.prototype._flush = function() {
} else { } else {
// Allows flush to complete before handling received messages. // Allows flush to complete before handling received messages.
(function(emitArgs) { (function(emitArgs) {
setImmediate(function(){ process.nextTick(function(){
self.emit.apply(self, emitArgs); self.emit.apply(self, emitArgs);
}); });
})(emitArgs); })(emitArgs);
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -8,7 +8,6 @@
"url": "http://github.com/JustinTulloss/zeromq.node.git" "url": "http://github.com/JustinTulloss/zeromq.node.git"
}, },
"dependencies": { "dependencies": {
"set-immediate": "*",
"nan": "~0.8.0", "nan": "~0.8.0",
"bindings": "~1.1.1" "bindings": "~1.1.1"
}, },
Expand Down

0 comments on commit 111b14b

Please sign in to comment.