Skip to content

Commit

Permalink
Consolidates incremental-dom usage in just one module
Browse files Browse the repository at this point in the history
  • Loading branch information
jbalsas committed Jun 8, 2017
1 parent 5f322d9 commit 6450454
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

import './incremental-dom';
import './incremental-dom-string';
import { getChanges, trackChanges } from './changes';
import { clearData, getData } from './data';
import { getOwner } from './children/children';
Expand Down
1 change: 0 additions & 1 deletion packages/metal-incremental-dom/src/incremental-dom-aop.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

import './incremental-dom';
import './incremental-dom-string';

/**
* Gets the original incremental dom functions.
Expand Down
14 changes: 0 additions & 14 deletions packages/metal-incremental-dom/src/incremental-dom-string.js

This file was deleted.

23 changes: 21 additions & 2 deletions packages/metal-incremental-dom/src/incremental-dom.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
import * as IncrementalDOM from 'incremental-dom';
import * as IncrementalDOMString from 'incremental-dom-string';

const scope = (typeof exports !== 'undefined' && typeof global !== 'undefined') ? global : window;
// Sets to true if running inside Node.js environment with extra check for
// `process.browser` to skip Karma runner environment. Karma environment has
// `process` defined even though it runs on the browser.
const isNode = (typeof process !== 'undefined') && !process.browser;

scope.IncrementalDOM = scope.IncrementalDOM || IncrementalDOM;
if (isNode && process.env.NODE_ENV !== 'test') {
// Overrides global.IncrementalDOM virtual elements with incremental dom
// string implementation for server side rendering. At the moment it does not
// override for Node.js tests since tests are using jsdom to simulate the
// browser.
if (!global.IncrementalDOM || global.IncrementalDOM.patch.toString() !== IncrementalDOMString.patch.toString()) {
global.IncrementalDOM = IncrementalDOMString;
}

} else {
const scope = (typeof exports !== 'undefined' && typeof global !== 'undefined') ? global : window;

if (!scope.IncrementalDOM || scope.IncrementalDOM.patch.toString() !== IncrementalDOM.patch.toString()) {
scope.IncrementalDOM = IncrementalDOM;
}
}
1 change: 0 additions & 1 deletion packages/metal-incremental-dom/src/intercept.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
'use strict';

import './incremental-dom';
import './incremental-dom-string';

/**
* Gets the original incremental dom functions.
Expand Down

0 comments on commit 6450454

Please sign in to comment.