mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 18:37:58 +01:00
Update hints on command change in :addons/:downloads.
This commit is contained in:
@@ -296,7 +296,7 @@ var EventHive = Class("EventHive", Contexts.Hive, {
|
||||
*/
|
||||
listen: function (target, event, callback, capture) {
|
||||
if (isObject(event))
|
||||
var [self, events] = [event, event[callback]];
|
||||
var [self, events] = [event, event[callback || "events"]];
|
||||
else
|
||||
[self, events] = [null, array.toObject([[event, callback]])];
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
|
||||
this.top = opts.window || content;
|
||||
this.top.addEventListener("resize", hints.resizeTimer.closure.tell, true);
|
||||
this.top.addEventListener("dactyl-commandupdate", hints.resizeTimer.closure.tell, true);
|
||||
|
||||
this.generate();
|
||||
|
||||
@@ -90,8 +91,10 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
if (!stack.push) {
|
||||
if (hints.hintSession == this)
|
||||
hints.hintSession = null;
|
||||
if (this.top)
|
||||
if (this.top) {
|
||||
this.top.removeEventListener("resize", hints.resizeTimer.closure.tell, true);
|
||||
this.top.removeEventListener("dactyl-commandupdate", hints.resizeTimer.closure.tell, true);
|
||||
}
|
||||
|
||||
this.removeHints(0);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,14 @@ var Template = Module("Template", {
|
||||
},
|
||||
|
||||
update: function update() {
|
||||
let collapsed = this.collapsed;
|
||||
this.collapsed = !this.commandAllowed;
|
||||
|
||||
if (collapsed == this.commandAllowed) {
|
||||
let event = this.node.ownerDocument.createEvent("Events");
|
||||
event.initEvent("dactyl-commandupdate", false, false);
|
||||
this.node.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user