1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-03 22:24:11 +01:00

Fix Bookmark* autocommand events.

Struct now only offers values during iteration like Array.
This commit is contained in:
Doug Kearns
2015-06-24 00:15:42 +10:00
parent ccfc69bc01
commit 5eece742e1
2 changed files with 6 additions and 2 deletions

View File

@@ -16,12 +16,12 @@ var Bookmarks = Module("bookmarks", {
storage.addObserver("bookmark-cache", function (key, event, arg) {
if (["add", "change", "remove"].indexOf(event) >= 0)
autocommands.trigger("Bookmark" + util.capitalize(event),
iter({
update({
bookmark: {
toString: function () "bookmarkcache.bookmarks[" + arg.id + "]",
valueOf: function () arg
}
}, arg).toObject());
}, arg.toObject()));
bookmarks.timer.tell();
}, window);
},

View File

@@ -1405,6 +1405,10 @@ var StructBase = Class("StructBase", Array, {
get: function struct_get(key, val) this[this.members[key]],
set: function struct_set(key, val) this[this.members[key]] = val,
toObject: function struct_toObject() {
return iter.toObject([k, this[k]] for (k of keys(this.members)));
},
toString: function struct_toString() Class.prototype.toString.apply(this, arguments),
// Iterator over our named members