aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-06-25 13:36:24 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-06-25 13:36:24 -0700
commit019267ac61bdbbf9f4ed340887687b7a2b9312bb (patch)
tree15b93ea6b5ff74178140e18d691ed5f91bf27c21
parentf25bcd0bdf50afe21dbb07dd5991f56e842e2d88 (diff)
allow exporting library functions
-rw-r--r--src/jsifier.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 2344b21f..d3a197b6 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -257,7 +257,11 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
} else {
ident = '_' + ident;
}
- return (deps ? '\n' + deps.map(addFromLibrary).join('\n') : '') + 'var ' + ident + '=' + snippet + ';';
+ var text = (deps ? '\n' + deps.map(addFromLibrary).join('\n') : '') + 'var ' + ident + '=' + snippet + ';';
+ if (ident in EXPORTED_FUNCTIONS) {
+ text += '\nModule["' + ident + '"] = ' + ident + ';';
+ }
+ return text;
}
item.JS = addFromLibrary(shortident);
} else {