summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2013-03-22 22:26:18 +0100
committerportix <portix@gmx.net>2013-03-22 22:26:18 +0100
commit293d55e18fa5c15485abbaf4a9569ea083952349 (patch)
tree07063c9be2d2f7f4e30d125a05f91a2d94646340 /scripts
parent7d8f205825c3dbe3c7c8cb77bd4d8bd8db53c527 (diff)
parentedaa59e89cdebf0d12c1bc04fa36f759109c9b56 (diff)
downloaddwb-293d55e18fa5c15485abbaf4a9569ea083952349.zip
Automated merge with ssh://bitbucket.org/portix/dwb
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/dwb.js49
1 files changed, 34 insertions, 15 deletions
diff --git a/scripts/lib/dwb.js b/scripts/lib/dwb.js
index e2122dab..57283f84 100644
--- a/scripts/lib/dwb.js
+++ b/scripts/lib/dwb.js
@@ -335,27 +335,46 @@
return _deprecated("sendRequestSync", "net.sendRequestSync", arguments);
}
},
- "_deprecationWarning" :
- {
- value : function(on, nn)
- {
- io.print("\033[31;1mDWB DEPRECATION:\033[0m " + on + "() is deprecated, use " + nn + "() instead!");
- }
- },
+ /**
+ * Print a deprecation warning for a function that is deprecated and call the new function
+ * @name _deprecated
+ * @function
+ * @example
+ * var oldfoo = {
+ * bar : function() {
+ * return _deprecated("oldfoo.bar", "newfoo.bar", arguments);
+ * }
+ * };
+ * var newfoo = {
+ * bar : function() {
+ * // new implementation
+ * };
+ * };
+ * // will print a deprecation warning and call newfoo.bar("foo");
+ * oldfoo.bar("foo");
+ *
+ * @param oldname {String}
+ * Name of the old function (including namespace)
+ * @param newname {String}
+ * Name of the new function (including namespace)
+ * @param arguments {Arguments}
+ * Arguments passed to the new function
+ *
+ * @returns {Object}
+ * The return value of the new function
+ *
+ * */
"_deprecated" :
{
value : function(on, nn, args)
{
var i, l, ns, ctx;
io.print("\033[31;1mDWB DEPRECATION:\033[0m " + on + "() is deprecated, use " + nn + "() instead!");
- if (args)
- {
- ns = nn.split(".");
- ctx = this;
- for (i=0, l=ns.length; i<l-1; i++)
- ctx = ctx[ns[i]];
- return ctx[ns[l-1]].apply(this, args);
- }
+ ns = nn.split(".");
+ ctx = this;
+ for (i=0, l=ns.length; i<l-1; i++)
+ ctx = ctx[ns[i]];
+ return ctx[ns[l-1]].apply(this, args);
}
},
"_initNewContext" :