Update frequently defaults quantity when still unchanged
parent
456f8e55cb
commit
b149e37aad
|
@ -20,11 +20,12 @@ const DEFAULTS = [
|
||||||
]
|
]
|
||||||
|
|
||||||
let frequently = store.get('frequently')
|
let frequently = store.get('frequently')
|
||||||
|
let defaults = {}
|
||||||
|
|
||||||
function add(emoji) {
|
function add(emoji) {
|
||||||
var { id } = emoji
|
var { id } = emoji
|
||||||
|
|
||||||
frequently || (frequently = {})
|
frequently || (frequently = defaults)
|
||||||
frequently[id] || (frequently[id] = 0)
|
frequently[id] || (frequently[id] = 0)
|
||||||
frequently[id] += 1
|
frequently[id] += 1
|
||||||
|
|
||||||
|
@ -34,10 +35,11 @@ function add(emoji) {
|
||||||
|
|
||||||
function get(perLine) {
|
function get(perLine) {
|
||||||
if (!frequently) {
|
if (!frequently) {
|
||||||
frequently = {}
|
defaults = {}
|
||||||
|
|
||||||
Array(perLine).fill('').forEach((_, i) => {
|
return Array(perLine).fill('').map((_, i) => {
|
||||||
frequently[DEFAULTS[i]] = perLine - i
|
defaults[DEFAULTS[i]] = perLine - i
|
||||||
|
return DEFAULTS[i]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue