Skip to content

Commit e2d3bc9

Browse files
committedSep 19, 2020
add deprecation notice for debug.destroy()
1 parent 72e7f86 commit e2d3bc9

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed
 

‎src/browser.js

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ exports.save = save;
99
exports.load = load;
1010
exports.useColors = useColors;
1111
exports.storage = localstorage();
12+
exports.destroy = (() => {
13+
let warned = false;
14+
15+
return () => {
16+
if (!warned) {
17+
warned = true;
18+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
19+
}
20+
};
21+
})();
1222

1323
/**
1424
* Colors.

‎src/common.js

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function setup(env) {
1212
createDebug.enable = enable;
1313
createDebug.enabled = enabled;
1414
createDebug.humanize = require('ms');
15+
createDebug.destroy = destroy;
1516

1617
Object.keys(env).forEach(key => {
1718
createDebug[key] = env[key];
@@ -114,6 +115,7 @@ function setup(env) {
114115
debug.useColors = createDebug.useColors();
115116
debug.color = createDebug.selectColor(namespace);
116117
debug.extend = extend;
118+
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
117119

118120
Object.defineProperty(debug, 'enabled', {
119121
enumerable: true,
@@ -243,6 +245,14 @@ function setup(env) {
243245
return val;
244246
}
245247

248+
/**
249+
* XXX DO NOT USE. This is a temporary stub function.
250+
* XXX It WILL be removed in the next major release.
251+
*/
252+
function destroy() {
253+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
254+
}
255+
246256
createDebug.enable(createDebug.load());
247257

248258
return createDebug;

‎src/node.js

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ exports.formatArgs = formatArgs;
1515
exports.save = save;
1616
exports.load = load;
1717
exports.useColors = useColors;
18+
exports.destroy = util.deprecate(
19+
() => {},
20+
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
21+
);
1822

1923
/**
2024
* Colors.

0 commit comments

Comments
 (0)
Please sign in to comment.