From a2831eb20314e5697f2cb39ce019def3de357984 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sun, 27 Nov 2011 09:46:02 +0000 Subject: [PATCH] Adopted a saner convention for handling modules that export a single class --- cook.js | 8 ++++---- ginsu.js | 4 ++-- js/Recipe.js | 8 ++++---- js/TiddlerInput.js | 4 ++-- js/TiddlerOutput.js | 3 +-- js/TiddlyWiki.js | 6 +++--- server.js | 8 ++++---- 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cook.js b/cook.js index 64a912e98..c25835383 100644 --- a/cook.js +++ b/cook.js @@ -3,13 +3,13 @@ // Usage: node cook.js var sys = require("sys"), - tiddlywiki = require("./js/TiddlyWiki.js"), - recipe = require("./js/Recipe.js"); + TiddlyWiki = require("./js/TiddlyWiki.js").TiddlyWiki, + Recipe = require("./js/Recipe.js").Recipe; var filename = process.argv[2]; -var store = new tiddlywiki.TiddlyWiki(); +var store = new TiddlyWiki(); -var theRecipe = new recipe.Recipe(store,filename); +var theRecipe = new Recipe(store,filename); process.stdout.write(theRecipe.cook()); diff --git a/ginsu.js b/ginsu.js index fac03f8cf..86615e868 100644 --- a/ginsu.js +++ b/ginsu.js @@ -8,7 +8,7 @@ var sys = require("sys"), fs = require("fs"), path = require("path"), - tiddler = require("./js/Tiddler.js"), + Tiddler = require("./js/Tiddler.js").Tiddler, tiddlyWikiInput = require("./js/TiddlyWikiInput.js"), tiddlerOutput = require("./js/TiddlerOutput.js"); @@ -20,7 +20,7 @@ var tiddlers = tiddlyWikiInput.parseTiddlyWiki(tiddlywikidoc); var recipe = []; for(var t=0; t -var tiddlywiki = require("./js/TiddlyWiki.js"), - recipe = require("./js/Recipe.js"), +var TiddlyWiki = require("./js/TiddlyWiki.js").TiddlyWiki, + Recipe = require("./js/Recipe.js").Recipe, sys = require("sys"), http = require("http"), fs = require("fs"), @@ -14,8 +14,8 @@ var filename = process.argv[2]; http.createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/html"}); - var store = new tiddlywiki.TiddlyWiki(); - var theRecipe = new recipe.Recipe(store,filename); + var store = new TiddlyWiki(); + var theRecipe = new Recipe(store,filename); response.end(theRecipe.cook(), "utf-8"); }).listen(8000);