dalejung / inode

Interactive Node.js
MIT License
3 stars 1 forks source link

ENH: Further make syncrify more uh, synchronous #33

Open dalejung opened 10 years ago

dalejung commented 10 years ago
var ipy = require('ipy_node');

var bridge = new ipy.Bridge("http://idale.local:8888")

var kernel = null;
var deferred = bridge.start_kernel("bb4dca5b-288f-5163-9450-9a06dfbaed70").then(function(kernel) {
  console.log('before');
});
console.log('after');

Right now, after shows up before before. Both console.log show up after start_kernel is run. So syncrify works fine for that. But I currently return a resolved promise from a wrapped promiser. The .then on a resolved promise is not synchronous, which is why after shows up before before.

I need to create a fake then function that just calls the callback synchronously and not via Q's nextick.

dalejung commented 10 years ago

A naive fake_then will work unless the promises are nested.