summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bolte <sbolte@lavabit.com>2013-05-15 03:14:11 +0200
committerStefan Bolte <sbolte@lavabit.com>2013-05-15 03:14:11 +0200
commite4f70c2dca7a7b2ee890c8b77a52be3efd5ebfcf (patch)
treec9774447162393cf74b7c9713c7b71a585766fac
parente2b36c4e56f806de2822967d2e69977e720346e8 (diff)
downloaddwb-e4f70c2dca7a7b2ee890c8b77a52be3efd5ebfcf.zip
New function script.include
-rw-r--r--scripts/lib/dwb.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/lib/dwb.js b/scripts/lib/dwb.js
index 625511d7..eae5bdf8 100644
--- a/scripts/lib/dwb.js
+++ b/scripts/lib/dwb.js
@@ -504,6 +504,32 @@
{
return object[key + id];
}.bind(self, id)
+ },
+ /**
+ * Includes a script, same as {@link include} but
+ * the path must be relative to including script
+ * path.
+ *
+ * @name include
+ * @memberOf script
+ * @function
+ *
+ * @param {String} relPath
+ * The relative path of the script
+ * @param {Boolean} global
+ * Whether to inject the script into the global
+ * scope
+ *
+ * @returns {Object}
+ * The object returned from the included script
+ * */
+ "include" :
+ {
+ value : function(relPath, global)
+ {
+ var dirName = path.substring(0, path.lastIndexOf("/") + 1);
+ return include(dirName + relPath, global);
+ }
}
});
Object.preventExtensions(self);