1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 22:47:59 +01:00

Update hints on command change in :addons/:downloads.

This commit is contained in:
Kris Maglione
2011-02-19 22:16:29 -05:00
parent d37e8159ed
commit 624563523d
3 changed files with 12 additions and 2 deletions

View File

@@ -296,7 +296,7 @@ var EventHive = Class("EventHive", Contexts.Hive, {
*/ */
listen: function (target, event, callback, capture) { listen: function (target, event, callback, capture) {
if (isObject(event)) if (isObject(event))
var [self, events] = [event, event[callback]]; var [self, events] = [event, event[callback || "events"]];
else else
[self, events] = [null, array.toObject([[event, callback]])]; [self, events] = [null, array.toObject([[event, callback]])];

View File

@@ -39,6 +39,7 @@ var HintSession = Class("HintSession", CommandMode, {
this.top = opts.window || content; this.top = opts.window || content;
this.top.addEventListener("resize", hints.resizeTimer.closure.tell, true); this.top.addEventListener("resize", hints.resizeTimer.closure.tell, true);
this.top.addEventListener("dactyl-commandupdate", hints.resizeTimer.closure.tell, true);
this.generate(); this.generate();
@@ -90,8 +91,10 @@ var HintSession = Class("HintSession", CommandMode, {
if (!stack.push) { if (!stack.push) {
if (hints.hintSession == this) if (hints.hintSession == this)
hints.hintSession = null; hints.hintSession = null;
if (this.top) if (this.top) {
this.top.removeEventListener("resize", hints.resizeTimer.closure.tell, true); this.top.removeEventListener("resize", hints.resizeTimer.closure.tell, true);
this.top.removeEventListener("dactyl-commandupdate", hints.resizeTimer.closure.tell, true);
}
this.removeHints(0); this.removeHints(0);
} }

View File

@@ -136,7 +136,14 @@ var Template = Module("Template", {
}, },
update: function update() { update: function update() {
let collapsed = this.collapsed;
this.collapsed = !this.commandAllowed; 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);
}
} }
}), }),