Skip to content

Commit 5b628f8

Browse files
committed
Merge pull request #7 from runningskull/browserify-upstream
Make compatible with Browserify
2 parents 994161e + 142c77e commit 5b628f8

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ Include the diffDOM.js file in your HTML like this:
2121
<script src="diffDOM.js">
2222
```
2323

24+
Or like this in node/browserify:
25+
```
26+
var diffDOM = require("diffDOM");
27+
```
28+
2429
Then create an instance of diffDOM within the javascript code:
2530
```
2631
dd = new diffDOM();

diffDOM.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,5 +882,14 @@
882882
},
883883
};
884884

885-
window.diffDOM = diffDOM;
886-
}());
885+
if (typeof exports !== 'undefined') {
886+
if (typeof module !== 'undefined' && module.exports) {
887+
exports = module.exports = diffDOM;
888+
}
889+
exports.diffDOM = diffDOM;
890+
} else {
891+
// `window` in the browser, or `exports` on the server
892+
this.diffDOM = diffDOM;
893+
}
894+
895+
}.call(this));

package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "diffDOM",
3+
"version": "0.0.1",
4+
"description": "A diff for DOM elements, as client-side JavaScript code. Gets all modifications, insertions and removals between two DOM fragments.",
5+
"main": "diffDOM.js",
6+
"directories": {
7+
"test": "tests"
8+
},
9+
"scripts": {
10+
"test": "echo \"Error: no test specified\" && exit 1"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git://github.com/fiduswriter/diffDOM.git"
15+
},
16+
"author": "Johannes Wilm [email protected]",
17+
"license": "LGPL",
18+
"bugs": {
19+
"url": "https://github.com/fiduswriter/diffDOM/issues"
20+
}
21+
}

0 commit comments

Comments
 (0)