signal-desktop/js/modules/emojis.js
2019-05-24 17:03:13 -07:00

28 lines
561 B
JavaScript

const { take } = require('lodash');
const { getRecentEmojis } = require('./data');
const { replaceColons } = require('../../ts/components/emoji/lib');
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;
}