Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #67 from VictorSigma/patch-1
Browse files Browse the repository at this point in the history
Exports for Node.js and Browserify
  • Loading branch information
John Messerly committed Oct 27, 2014
2 parents 91c5c34 + ffdfb18 commit 2f95aa6
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/observe.js
Original file line number Diff line number Diff line change
Expand Up @@ -1679,19 +1679,33 @@
return splices;
}

global.Observer = Observer;
global.Observer.runEOM_ = runEOM;
global.Observer.observerSentinel_ = observerSentinel; // for testing.
global.Observer.hasObjectObserve = hasObserve;
global.ArrayObserver = ArrayObserver;
global.ArrayObserver.calculateSplices = function(current, previous) {
// Export the observe-js object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, export as a global object.

var expose = global;

if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
expose = exports = module.exports;
}
expose = exports;
}

expose.Observer = Observer;
expose.Observer.runEOM_ = runEOM;
expose.Observer.observerSentinel_ = observerSentinel; // for testing.
expose.Observer.hasObjectObserve = hasObserve;
expose.ArrayObserver = ArrayObserver;
expose.ArrayObserver.calculateSplices = function(current, previous) {
return arraySplice.calculateSplices(current, previous);
};

global.ArraySplice = ArraySplice;
global.ObjectObserver = ObjectObserver;
global.PathObserver = PathObserver;
global.CompoundObserver = CompoundObserver;
global.Path = Path;
global.ObserverTransform = ObserverTransform;
expose.ArraySplice = ArraySplice;
expose.ObjectObserver = ObjectObserver;
expose.PathObserver = PathObserver;
expose.CompoundObserver = CompoundObserver;
expose.Path = Path;
expose.ObserverTransform = ObserverTransform;

})(typeof global !== 'undefined' && global && typeof module !== 'undefined' && module ? global : this || window);

0 comments on commit 2f95aa6

Please sign in to comment.