I'm coming back to JointJS after a year away and I see that it now claims some kind of Node.js support or compatibility. I'm using Node.js and am wondering whether I can leverage this feature. Is there a tutorial which walks me through this or can someone please explain what Node.js model integration offers me for JointJS?
http://www.jointjs.com/ claims "NodeJS support".
The Git commit log contains comments like "create tests for NodeJS environment".
Yes, JointJS supports NodeJS environment. Note that only models are supported (element, link, graph). For example, you can build your graph on the server side, then stringify it to JSON, send it to the client and there you can display that graph:
Install jointjs: npm install jointjs
Create your graph in NodeJS:
var joint = require('jointjs');
var graph = new joint.dia.Graph;
var el1 = new joint.shapes.basic.Rect({ position: { x: 50, y: 50 }, attrs: { text: { fill: 'yellow' } }});
var el2 = new joint.shapes.basic.Rect({ position: { x: 300, y: 200 }, attrs: { text: { fill: 'yellow' } }});
var link = new joint.dia.Link({ source: { id: el1.id }, target: { id: el2.id } });
graph.addCells([el1, el2, link]);
Do what you need with the graph:
storeToDBOrSendToClient(graph.toJSON())
As long as you work with JointJS models, you can take advantage of all the features of JointJS in NodeJS environment.