diff options
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"); } } |