0

We're evaluating noflo to be executed on an embedded linux box using an simple javascript engine, being an interpreter (no JIT). In our case, the Node.js engine (with embedded V8 engine) might be too resource intensive.

The immediate question is the how to run the noflo runtime in there. Checking out the GitHub repository (https://github.com/noflo/noflo) and using grunt, we have generated the noflo for the browser using grunt build:browser.

As simple example to actually try and run the generated browser/noflo.js file, I used the d8 shell (V8 engine shell) for an isolated Javascript engine outside the Node.js universe, and appended the following code to the noflo.js generated file:

var fbpData = "<some FBP language connections>";

var noflo = require('noflo');
noflo.graph.loadFbp(fbpData, function(graph) {
    print("Graph loaded");
});

Then, d8 noflo.js

on the Linux shell, which reports

rtm.js:9559: TypeError: undefined is not a function
noflo.graph.loadFbp(fbpData, function(graph) {
            ^
TypeError: undefined is not a function
at rtm.js:9559:13

Without knowing further, leads me to believe that the noflo.js is not self-contained with all core noflo runtime functionality.

What necessary steps are missing here, for me to get noflo library running in an isolated JS engine (V8 is just an example - it could be any engine the is ECMA V5 compliant)

All code examples on the noflo project web site are tailored for Node.js...

PS: I tried as an alternative to build a browser-based noflo from http://noflojs.org/download/, however this always returns "server error".

Best regards

Gunther Strube

3 Answers3

1

The NoFlo-Gnome project contains a browser build of the noflo-runtime-base repository (https://github.com/noflo/noflo-runtime-base) which itself embeds NoFlo.

You might need to add some aliases because the browser build doesn't necessarily fit your engine : https://github.com/noflo/noflo-gnome/blob/master/src/noflo.js#L89

Dj-Death
  • 11
  • 1
0

noflo-gnome runs NoFlo in GJS, which is based on Spidermonkey and GLib/GObject.

It has some minimal require() compatibility which allows pulling in NoFlo. There is a checked in build of noflo (+ noflo-runtime-base) in ./src/libs but I did not immediately find how this is created.

Jon Nordby
  • 5,494
  • 1
  • 21
  • 50
0

If you're considering using a browser build to speed up the startup time, you might also want to look at : https://github.com/djdeath/noflo-iot At some point I tried to run NoFlo on a board with very slow I/O. It turned out that a single file compacted build of NoFlo (including all the needed components) was significantly faster.

Dj-Death
  • 11
  • 1