6

I'm using node-webkit with an external module called edge.

According to the node-webkit docs modules that contain native code must be recompiled using nw-gyp as oppose to node-gyp. I was able to recompile without error and node-webkit seems to import the module OK.

Heres my code. The code I'm trying to use:

var edge = require('edge.node');

var hello = edge.func(function () {/*
async (input) => 
{ 
    return ".NET welcomes " + input.ToString(); 
}
*/});

hello('Node.js', function (error, result) {
if (error) throw error;
console.log(result);
});

Which throws the following error when run within node-webkit.

Uncaught TypeError: Object [object Object] has no method 'func' 

If write the object out to console.log I can see:

 Object {initializeClrFunc: function}
 initializeClrFunc: function () { [native code] }
 __proto__: Object

So the module seems to have loaded. If I run the same code outside of node-webkit, everything works perfectly and I can access the func function. This is driving me crazy - and any help would be really appreciated.

Jason Nichols
  • 3,739
  • 3
  • 29
  • 49
user1513388
  • 7,165
  • 14
  • 69
  • 111
  • 1
    +1 , what you're trying to make sounds very interesting. Edge is _extremely_ experimental technology, you might want to open an issue in their github. – Benjamin Gruenbaum Jun 04 '13 at 14:46
  • Yeah - already did that. Really need to try and this to work for a show-case app that I'm building. – user1513388 Jun 04 '13 at 16:19

1 Answers1

0

func method is provided by edge.js, the wrapper around edge.node native module. So you should replace require('edge.node') by require('edge').

CedX
  • 3,854
  • 2
  • 36
  • 45