X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=src%2Fextras%2Fsynchronizer.js;h=bf5b6f34b1177663da39d4ef4c71d33e3496b1b4;hb=401ff9f17c622f3173cc8d34cfcf3e444620d7d0;hp=dd4329cf25b0942b5f61b82e81c4ece6087d56c4;hpb=bf50de0db3094fc5155efc8aee14112df2545e42;p=dygraphs.git diff --git a/src/extras/synchronizer.js b/src/extras/synchronizer.js index dd4329c..bf5b6f3 100644 --- a/src/extras/synchronizer.js +++ b/src/extras/synchronizer.js @@ -35,7 +35,14 @@ /* global Dygraph:false */ 'use strict'; -Dygraph.synchronize = function(/* dygraphs..., opts */) { +var Dygraph; +if (window.Dygraph) { + Dygraph = window.Dygraph; +} else if (typeof(module) !== 'undefined') { + Dygraph = require('../dygraph'); +} + +var synchronize = function(/* dygraphs..., opts */) { if (arguments.length === 0) { throw 'Invalid invocation of Dygraph.synchronize(). Need >= 1 argument.'; } @@ -217,4 +224,6 @@ function attachSelectionHandlers(gs, prevCallbacks) { } } +Dygraph.synchronize = synchronize; + })();