1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-26 19:47:20 +00:00

Cleaned up some dead/commented in patches.

This commit is contained in:
natecain 2013-09-17 22:38:14 -04:00
parent c9d2364e0c
commit 5c92ec3617

View File

@ -370,9 +370,7 @@ $tw.utils.registerFileType = function(type,encoding,extension) {
Run code globally with specified context variables in scope Run code globally with specified context variables in scope
*/ */
$tw.utils.evalGlobal = function(code,context,filename) { $tw.utils.evalGlobal = function(code,context,filename) {
var contextCopy = $tw.utils.extend({},context/*,{ var contextCopy = $tw.utils.extend({},context);
exports: {}
}*/);
// Get the context variables as a pair of arrays of names and values // Get the context variables as a pair of arrays of names and values
var contextNames = [], contextValues = []; var contextNames = [], contextValues = [];
$tw.utils.each(contextCopy,function(value,name) { $tw.utils.each(contextCopy,function(value,name) {
@ -397,9 +395,6 @@ Run code in a sandbox with only the specified context variables in scope
*/ */
$tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code,context,filename) { $tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code,context,filename) {
var sandbox = $tw.utils.extend({},context); var sandbox = $tw.utils.extend({},context);
//$tw.utils.extend(sandbox,{
// exports: {}
//});
vm.runInNewContext(code,sandbox,filename); vm.runInNewContext(code,sandbox,filename);
return sandbox.exports; return sandbox.exports;
}; };
@ -594,14 +589,8 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
moduleInfo.exports = _exports; moduleInfo.exports = _exports;
moduleInfo.definition(moduleInfo,moduleInfo.exports,sandbox.require); moduleInfo.definition(moduleInfo,moduleInfo.exports,sandbox.require);
} else if(typeof moduleInfo.definition === "string") { // String } else if(typeof moduleInfo.definition === "string") { // String
var temp;
moduleInfo.exports = _exports; moduleInfo.exports = _exports;
temp = $tw.utils.evalSandboxed(moduleInfo.definition,sandbox,tiddler.fields.title); $tw.utils.evalSandboxed(moduleInfo.definition,sandbox,tiddler.fields.title);
for(var k in temp) {
moduleInfo.exports[k] = temp[k]
}
//$tw.utils.extend(exports, temp)
//moduleInfo.exports = temp;
} else { // Object } else { // Object
moduleInfo.exports = moduleInfo.definition; moduleInfo.exports = moduleInfo.definition;
} }