send/app/templates/activeBackground/index.js

13 lines
319 B
JavaScript
Raw Normal View History

2018-06-19 19:58:42 +00:00
const assets = require('../../../common/assets');
2018-06-20 22:23:15 +00:00
module.exports = function(state) {
2018-06-21 18:28:31 +00:00
if (!state.backgroundClass) {
const backgrounds = assets.match(/background_/);
state.backgroundClass = `background_${Math.floor(
Math.random() * backgrounds.length
) + 1}`;
2018-06-20 22:23:15 +00:00
}
2018-06-21 18:28:31 +00:00
return state.backgroundClass;
2018-06-19 19:58:42 +00:00
};