Skip to content

Commit 15bc242

Browse files
committed
Migrated SvgCanvas to use require() (except in tests)
1 parent a7c7fe4 commit 15bc242

4 files changed

Lines changed: 5 additions & 6 deletions

File tree

Jakefile.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
task("test", ["testServer", "testClient", "testSmoke"]);
6767

6868
desc("Test server code");
69-
task("testServer", ["nodeVersion", TEMP_TESTFILE_DIR], function() {
69+
task("testServer", ["nodeVersion", "build", TEMP_TESTFILE_DIR], function() {
7070
nodeunit.runTests(serverTestFiles(), complete, fail);
7171
}, {async: true});
7272

@@ -88,7 +88,6 @@
8888
console.log("Bundling client files with Browserify...");
8989
var b = browserify([
9090
"./src/client/client.js",
91-
"./src/client/svg_canvas.js",
9291
"./src/client/html_element.js"
9392
// "./src/client/vendor/jquery-1.8.2.js",
9493
// "./src/client/vendor/raphael-2.1.0.js"

src/client/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ window.wwp = window.wwp || {};
1616
if (svgCanvas !== null) throw new Error("Client.js is not re-entrant");
1717
drawingArea = htmlElement;
1818

19-
svgCanvas = new wwp.SvgCanvas(drawingArea);
19+
svgCanvas = new SvgCanvas(drawingArea);
2020
handleDragEvents();
2121
return svgCanvas;
2222
};

src/client/svg_canvas.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(function() {
55
"use strict";
66

7-
var SvgCanvas = wwp.SvgCanvas = function(htmlElement) {
7+
var SvgCanvas = module.exports = wwp.SvgCanvas = function(htmlElement) {
88
this._paper = new Raphael(htmlElement.toDomElement());
99
};
1010

@@ -84,6 +84,4 @@
8484
];
8585
}
8686

87-
module.exports = SvgCanvas;
88-
8987
}());

todo.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Engineering Tasks:
2323

2424
To Do on current task:
2525
- Incrementally migrate our code from wwp global to browserify's require() calls
26+
- Get tests working with require()
27+
- Get index.html working with require()
2628
- Figure out how to bundle vendor files
2729
- What about deployment? (Punt?)
2830
- Duplication between weewikipaint.js CONTENT_DIR and our Jakefile

0 commit comments

Comments
 (0)