0

我正在尝试更新 Gnome-shell 扩展。在其中,我覆盖了一个对象的 _init 方法,我正在这样做:

function newInitAppSwitcherPopup() {
     this.parent();        
     ...
}
AltTab.AppSwitcherPopup.prototype._init = newInitAppSwitcherPopup;

新方法失败:

JS 错误:TypeError:无法调用方法“父”

我在这里发现非常令人惊讶的是该parent方法确实存在(如果我更改名称,我会收到“未定义”错误)。

我不明白的是,原来的 AppSwitcherPopup._init 仍在使用这个对父级的调用(https://git.gnome.org/browse/gnome-shell/tree/js/ui/altTab.js?h=gnome -3-16#n54)。

这在 Gnome 3.12 下运行良好,但在 Gnome 3.16 中被破坏了......我猜他们在 GObject 或继承模型中改变了一些东西?

4

1 回答 1

0

我有一个类似的代码适用于我的配置小部件

const MenuConfigWidget = new GObject.Class({
  Name: 'SimpleMenu.Prefs.MenuConfigWidget',
  GTypeName: 'SimpleMenuMenuConfigWidget',
  Extends: Gtk.Grid,

  _init: function(params) {
    this.parent({... }); 
    ...
  }
});

您是否扩展了我们刚刚为 _init 函数打补丁的类?

于 2016-02-19T16:37:00.733 回答