Skip to content

Leoxyzua/fumo-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a fork of the fumo api, but better.

Added

  • A client class where all functions are passed
  • Cache systems

Install with npm install @leoua/fumo-api or yarn add @leoua/fumo-api

Example Usage (no cache)

const client = new FumoClient({ cache: false });

(async () => {
    const fumo = await client.fetchRandomFumo();

    console.log(fumo);
})();

Working With Cache

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);

Working With Custom Cache

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

Packages

No packages published

Languages

  • TypeScript 100.0%