Giter Club home page Giter Club logo

Comments (4)

gmaclennan avatar gmaclennan commented on May 14, 2024

What about using browserify --standalone d3? Then you would write standalone.js as:

var event = require("./lib/d3/event"),
    namespace = require("./lib/d3/namespace"),
    selection = require("./lib/d3/selection"),
    d3;

d3.mouse = event.mouse;
d3.touch = event.touch;
d3.touches = event.touches;
d3.namespace = namespace.prefix;
d3.selection = selection;
d3.select = selection.select;
d3.selectAll = selection.selectAll;

// Deprecated aliases for backwards-compatibility with 3.x:
d3.ns = namespace;
selection.prototype.on = selection.prototype.event;
selection.prototype.insert = selection.prototype.append;
selection.prototype.classed = selection.prototype.class;

module.exports = d3;

browserify --standalone d3 output would include a UMD and would be compatible with RequireJS etc.

from d3-selection.

mbostock avatar mbostock commented on May 14, 2024

Yes (mostly). See #26.

from d3-selection.

mbostock avatar mbostock commented on May 14, 2024

Mostly fixed by #30, but event listeners still depend on the d3 global, and Iā€™m not sure how to fix that.

from d3-selection.

mbostock avatar mbostock commented on May 14, 2024

Actually, since d3.event is only needed within the context of an event listener, it seems fine as-is.

from d3-selection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.