mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-01 08:55:46 +01:00
Deprecate liberator alias.
This commit is contained in:
@@ -23,12 +23,12 @@ function deprecated(reason, fn) {
|
|||||||
let name, func = callable(fn) ? fn : function () this[fn].apply(this, arguments);
|
let name, func = callable(fn) ? fn : function () this[fn].apply(this, arguments);
|
||||||
function deprecatedMethod() {
|
function deprecatedMethod() {
|
||||||
let frame = Components.stack.caller;
|
let frame = Components.stack.caller;
|
||||||
|
let obj = this.className || this.constructor.className;
|
||||||
if (!set.add(deprecatedMethod.seen, frame.filename))
|
if (!set.add(deprecatedMethod.seen, frame.filename))
|
||||||
dactyl.echoerr(
|
dactyl.echoerr(
|
||||||
frame.filename.replace(/^.*? -> /, "") +
|
(frame.filename || "unknown").replace(/^.*? -> /, "") +
|
||||||
":" + frame.lineNumber + ": " +
|
":" + frame.lineNumber + ": " +
|
||||||
(this.className || this.constructor.className) + "." +
|
(obj ? obj + "." : "") + (fn.name || name) + " is deprecated: " + reason);
|
||||||
(fn.name || name) + " is deprecated: " + reason);
|
|
||||||
return func.apply(this, arguments);
|
return func.apply(this, arguments);
|
||||||
}
|
}
|
||||||
deprecatedMethod.seen = { "chrome://dactyl/content/javascript.js": true };
|
deprecatedMethod.seen = { "chrome://dactyl/content/javascript.js": true };
|
||||||
@@ -42,8 +42,9 @@ const Dactyl = Module("dactyl", {
|
|||||||
init: function () {
|
init: function () {
|
||||||
window.dactyl = this;
|
window.dactyl = this;
|
||||||
// cheap attempt at compatibility
|
// cheap attempt at compatibility
|
||||||
window.liberator = this;
|
let prop = { get: deprecated("Please use dactyl instead", function liberator() dactyl) };
|
||||||
modules.liberator = this;
|
Object.defineProperty(window, "liberator", prop);
|
||||||
|
Object.defineProperty(modules, "liberator", prop);
|
||||||
this.commands = {};
|
this.commands = {};
|
||||||
this.modules = modules;
|
this.modules = modules;
|
||||||
this.observers = {};
|
this.observers = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user