From 7665e449cdfff1e660ed2bbac3de4507cb063a18 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Mon, 27 Sep 2010 20:06:22 +0000 Subject: CommonJS support in map functions git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1001895 13f79535-47bb-0310-9956-ffa450edef68 --- share/server/state.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'share/server/state.js') 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"); } } -- cgit v1.2.3