This is a fork of the fumo api, but better.
- A client class where all functions are passed
- Cache systems
Install with npm install @leoua/fumo-api
or yarn add @leoua/fumo-api
const client = new FumoClient({ cache: false });
(async () => {
const fumo = await client.fetchRandomFumo();
console.log(fumo);
})();
const client = new FumoClient({
cache: true // Optional, default is set to true
});
// Wait a bit for the fumos to get cached
setTimeout(function () {
console.log(`Random fumo: ${client.cache.random().URL}`);
}, 2500);
const myFumos = [
{
URL: 'https://tenor.com/view/yuyuko-yuyuko-saigyouji-touhou-fumo-touhou-fumo-gif-25089428',
_id: 'yuyuko_dead',
__v: 0,
},
];
const client = new FumoClient({
cache: true, // Optional, default is set to true
customCache: myFumos,
});
console.log(client.cache.random()._id); // yuyuko_dead