-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidates incremental-dom usage in just one module
- Loading branch information
Showing
5 changed files
with
21 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
packages/metal-incremental-dom/src/incremental-dom-string.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters