signal-desktop/js/modules/emojis.js

29 lines
561 B
JavaScript
Raw Normal View History

2019-05-24 23:58:27 +00:00
const { take } = require('lodash');
const { getRecentEmojis } = require('./data');
const { replaceColons } = require('../../ts/components/emoji/lib');
2019-05-24 23:58:27 +00:00
module.exports = {
getInitialState,
load,
replaceColons,
};
let initialState = null;
async function load() {
const recents = await getRecentEmojisForRedux();
initialState = {
recents: take(recents, 32),
};
}
async function getRecentEmojisForRedux() {
const recent = await getRecentEmojis();
return recent.map(e => e.shortName);
}
function getInitialState() {
return initialState;
}