summaryrefslogtreecommitdiff
path: root/doc/api/util.markdown
diff options
context:
space:
mode:
authorYazhong Liu <yorkiefixer@gmail.com>2014-05-07 17:48:55 +0800
committerTrevor Norris <trev.norris@gmail.com>2014-05-07 14:56:21 -0700
commita4f2f9ea8a2a0388c1d76838b90e87b623863868 (patch)
tree6359b80e83390e9442ef85fe6a9045bf1996ec26 /doc/api/util.markdown
parentf10fd1ddba8a58151a58ca46008788b8bc82887f (diff)
downloadnode-new-a4f2f9ea8a2a0388c1d76838b90e87b623863868.tar.gz
doc: add spec for util.deprecate()
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'doc/api/util.markdown')
-rw-r--r--doc/api/util.markdown15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/api/util.markdown b/doc/api/util.markdown
index 2aab8c95c0..dc6c0f64ee 100644
--- a/doc/api/util.markdown
+++ b/doc/api/util.markdown
@@ -257,6 +257,21 @@ through the `constructor.super_` property.
stream.write("It works!"); // Received data: "It works!"
+## util.deprecate(function, string)
+
+Marks that a method should not be used any more.
+
+ exports.puts = exports.deprecate(function() {
+ for (var i = 0, len = arguments.length; i < len; ++i) {
+ process.stdout.write(arguments[i] + '\n');
+ }
+ }, 'util.puts: Use console.log instead')
+
+It returns a modified function which warns once by default. If
+`--no-deprecation` is set then this function is a NO-OP. If
+`--throw-deprecation` is set then the application will throw an exception
+if the deprecated API is used.
+
## util.debug(string)
Stability: 0 - Deprecated: use console.error() instead.