Skip to content

Commit

Permalink
added use() functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
tblobaum committed Nov 1, 2011
1 parent 81f424e commit ed0f086
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions lib/nodeQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,28 @@ var pkg = {
'require': ['dnode'],
'mount': '/nquery.js',
};
var fns = [];

module.exports.middleware = function (client, conn , fn) {
if (client.res) {
var req = client,
res = conn,
next = fn;
if (module.exports.debug) console.log('express middleware loaded', req.url);

} else {
if (module.exports.debug) console.log('dnode middleware loaded');

forEach.fns(function (fn) {
fn.call(this, client, conn, $);
});

}
};

module.exports.use = function (fn) {
fns.push(fn);
};

if (!module.exports.debug) pkg.filter = require('uglify-js');
module.exports.bundle = Browserify(pkg);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nodeQuery",
"description": "DOM manipulation from the server.",
"author": "Thomas Blobaum",
"version": "0.0.7-5",
"version": "0.0.8-1",
"main": "index.js",
"keywords": [
"DOM",
Expand All @@ -25,7 +25,7 @@
"url": "https://tblobaum@github.com/tblobaum/nodeQuery.git"
},
"engines": {
"node": "~0.5.10"
"node": ">=0.4.10"
},
"subdomain": "todos",
"scripts": {
Expand Down

0 comments on commit ed0f086

Please sign in to comment.