deprecate boolean highlightMode param (#11993)
* deprecate boolean highlightMode param * add process.noDeprecations check * fix native method override * add todo
This commit is contained in:
parent
719e5a93b4
commit
193febd18c
2 changed files with 24 additions and 0 deletions
|
@ -39,6 +39,16 @@ struct Converter<atom::TrayIcon::HighlightMode> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool highlight;
|
||||||
|
if (ConvertFromV8(isolate, val, &highlight)) {
|
||||||
|
if (highlight)
|
||||||
|
*out = atom::TrayIcon::HighlightMode::SELECTION;
|
||||||
|
else
|
||||||
|
*out = atom::TrayIcon::HighlightMode::NEVER;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
const {EventEmitter} = require('events')
|
const {EventEmitter} = require('events')
|
||||||
|
const {deprecate} = require('electron')
|
||||||
const {Tray} = process.atomBinding('tray')
|
const {Tray} = process.atomBinding('tray')
|
||||||
|
|
||||||
Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype)
|
Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype)
|
||||||
|
|
||||||
|
// TODO(codebytere): remove in 3.0
|
||||||
|
const nativeSetHighlightMode = Tray.prototype.setHighlightMode
|
||||||
|
Tray.prototype.setHighlightMode = function (param) {
|
||||||
|
if (!process.noDeprecations && typeof param === 'boolean') {
|
||||||
|
if (param) {
|
||||||
|
deprecate.warn('tray.setHighlightMode(true)', `tray.setHighlightMode("on")`)
|
||||||
|
} else {
|
||||||
|
deprecate.warn('tray.setHighlightMode(false)', `tray.setHighlightMode("off")`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nativeSetHighlightMode.call(this, param)
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = Tray
|
module.exports = Tray
|
||||||
|
|
Loading…
Reference in a new issue