epochjs / epoch

A general purpose, real-time visualization library.
http://epochjs.github.io/epoch
MIT License
4.97k stars 278 forks source link

AMD version of epoch? #150

Open dimddev opened 9 years ago

dimddev commented 9 years ago

Hello, do you plan to release AMD version of epoch?

rsandor commented 9 years ago

By AMD I assume you are referring to the Asynchronous Module Definition? If so, I think this is a good idea. However, I am not sure how it would change the project, nor am I familiar with converting a library to use AMD.

@dimddev - Can you share some thoughts on how you'd propose going about doing this? If so, a pull request would be amazing to explain the process.

dimddev commented 9 years ago

Hello,

yes, AMD == Asynchronous Module Definition

In my project I use requirejs and all my app are writen by AMD definition and in first, when I try to use epoch I got some issues with d3.js and epoch - because of async nature of requirejs.

so I solve my issue when I added one line of top in epoch:

define(['d3'], function(d3) {

(function () {
    ...

and this ensure that d3 is loaded when i try to access window.Epoch and of course we have to loaded d3 correctly before that

Cheers

bk-cribl commented 9 years ago

I second this

rsandor commented 9 years ago

Still waiting on PRs concerning this. I have heard mixed reviews on AMD some people are for it, others are against it. In most production environments I have worked on we tend to pre-package the software and have it come down in one or two master files. Modern CDNs manage this pretty well, and browser caching makes it less of a big deal.