Added getKittens method (placeholder images)

This commit is contained in:
Sebin Nyshkim 2019-11-06 12:25:06 +01:00
parent 3094f5437a
commit 11f0e038d3

View file

@ -11,6 +11,25 @@ export default {
return muscles;
},
getKittens(count) {
let kittens = [];
for (let i = 0; i < count; i++) {
let width = this.getRandomInt(300, 600);
let height = this.getRandomInt(300, 600);
kittens.push(`https://placekitten.com/${width}/${height}`);
}
return kittens;
},
getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
max++; // make it inclusive
return Math.floor(Math.random() * (max - min)) + min;
},
getClientLocale() {
if (navigator.language) {
return navigator.languages[0];