Order buffers by priority in Alt+a
This commit is contained in:
parent
958b6bf120
commit
e38f35c578
2 changed files with 12 additions and 5 deletions
7
state.js
7
state.js
|
@ -15,13 +15,16 @@ export const Unread = {
|
|||
MESSAGE: "message",
|
||||
HIGHLIGHT: "highlight",
|
||||
|
||||
union(a, b) {
|
||||
compare(a, b) {
|
||||
const priority = {
|
||||
[Unread.NONE]: 0,
|
||||
[Unread.MESSAGE]: 1,
|
||||
[Unread.HIGHLIGHT]: 2,
|
||||
};
|
||||
return (priority[a] > priority[b]) ? a : b;
|
||||
return priority[a] - priority[b];
|
||||
},
|
||||
union(a, b) {
|
||||
return (Unread.compare(a, b) > 0) ? a : b;
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue