Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15670

Integrate Node.js to VB6 (or RC6)

$
0
0
There are many excellent libs on the Internet that are written in JavaScript or TypeScript, but it is difficult for us to use these libs directly in VB6, because the default running environment of these code libs is Node.js, not Web-Browser.

I'd like to know if it is possible to integrate Node.js into VB6 (or RC6), just like RC6 WebView2-Binding (Edge-Chromium).

In this way, I can call Node.js in VB6 to easily execute some JavaScript libs or TypeScript libs, for example:

Code:

sScript = "var esprima = require('esprima');" & _
            "var program = 'const answer = 42';" & -
            "esprima.tokenize(program);"

vbNodeJS.Start

sResult = vbNodeJS.ExecuteScript(sScript)

Or

Code:

With vbNodeJS
    .Start

    .Cmd "var esprima = require('esprima');"
    .Cmd "var program = 'const answer = 42';"
   
    sResult = .Execute("esprima.tokenize(program);")
End With

Any help and suggestions would be greatly appreciated.

Viewing all articles
Browse latest Browse all 15670

Trending Articles