a.saveFirstValue = Object.assign({}, r);
var redisClient = require('../lib/redis');
var getChatData = function () {
return new Promise((resolve, reject) => {
redisClient.lrange('messages', 0, 4, (err, reply) => {
if (err) {
reject(err);
} else {
resolve(reply.map(msg => JSON.parse(msg)));
}
});
});
}
module.exports = getChatData;
(async () => {
try {
const HomeModel = require('../models/Home');
console.log(await HomeModel());
} catch (err) {
console.error(err);
}
})();
var selector = document.getElementById('target-select');
var messageContainer = document.getElementById('message-container');
var dict = {
'0': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod',
'1': 'tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam',
'2': 'quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo',
'3': 'consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse',
'4': 'cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non',
'5': 'proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
}
function onSelect(){
messageContainer.innerHTML = dict[selector.options[selector.selectedIndex].value];
}
selector.addEventListener('change', onSelect);
onSelect();