javascript - Making Node.js work with tree-model-js -
thanks tree-model-js, great lib! new node.js , i'm trying import tree-model. npmed successfully. trying make node.js work library. guess node question , not tree-model issue, asking anyway in case lib needs changed it.
i have following:
var tm = require('tree-model'); //all far.
but when trying recreate code works on webpage
//is how access it? tm.tree = new treemodel();
it giving me error. have examples on how can achieved in node?
essentially trying within main.js node file struggling understand how access variables/functions. works when on webpage when following:
tree = new treemodel(); root = tree.parse({ name: "ben , jerry" });
any examples appreciated. please keep in mind new node.js , somehow rookie on javascript. learn better examples feel free point me in right direction.
the error quite simple: treemodel not defined.
require('tree-model')
returns new node(this.config, model)
, in code, node
assigned variable tm
. should use new tm()
instantiate node
or change variable name treemodel
Comments
Post a Comment