diff options
author | John Christopher Anderson <jchris@apache.org> | 2010-09-27 20:06:22 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2010-09-27 20:06:22 +0000 |
commit | 7665e449cdfff1e660ed2bbac3de4507cb063a18 (patch) | |
tree | a3c7994475d955fce448af9a8c60c202c0e92f6e /share/server | |
parent | 6c6db011c2064597526c6f36878a282238dd2bf2 (diff) |
CommonJS support in map functions
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1001895 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/server')
-rw-r--r-- | share/server/loop.js | 1 | ||||
-rw-r--r-- | share/server/state.js | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/share/server/loop.js b/share/server/loop.js index 300151e9..d5bbd977 100644 --- a/share/server/loop.js +++ b/share/server/loop.js @@ -100,6 +100,7 @@ var Loop = function() { // "view" : Views.handler, "reset" : State.reset, "add_fun" : State.addFun, + "add_lib" : State.addLib, "map_doc" : Views.mapDoc, "reduce" : Views.reduce, "rereduce" : Views.rereduce diff --git a/share/server/state.js b/share/server/state.js index 9af9e475..e6416382 100644 --- a/share/server/state.js +++ b/share/server/state.js @@ -14,6 +14,7 @@ var State = { reset : function(config) { // clear the globals and run gc State.funs = []; + State.lib = null; State.query_config = config || {}; init_sandbox(); gc(); @@ -21,7 +22,11 @@ var State = { }, addFun : function(newFun) { // Compile to a function and add it to funs array - State.funs.push(Couch.compileFunction(newFun)); + State.funs.push(Couch.compileFunction(newFun, {views : {lib : State.lib}})); + print("true"); + }, + addLib : function(lib) { + State.lib = lib; print("true"); } } |