Monday, September 4, 2017

How do I set up the plugins to work with the sigma.js global object in Require.js?

In /node_modules/sigma/plugins/sigma.layout.forceAtlas2/supervisor.js I have:  

/**
   * Interface
   * ----------
   */
  sigma.prototype.startForceAtlas2 = function(config) {

    // Create supervisor if undefined
    if (!this.supervisor)
      this.supervisor = new Supervisor(this, config);

    // Configuration provided?
    if (config)
      this.supervisor.configure(config);

    // Start algorithm
    this.supervisor.start();

    return this;
  };

I want to bind this to the sigma global object.


Otherwise I get this:


How did I set up other libraries in node-arc-d3?
http://www.forbeslindesay.co.uk/post/46324645400/standalone-browserify-builds

or browserify exportN3.js -s N3 -o bun2-exportN3.js

http://raptorlicious.blogspot.com/2017/02/exposing-n3-from-script-tag-in-browser.html

Browserify with sigma: https://github.com/jacomyal/sigma.js/issues/680

so I need to do something like?:

browserify /src/sigma.exports.js -s sigma -o bun-sigma.exports.js

/build/plugins/sigma.layout.forceAtlas2.min.js

No comments:

Post a Comment