Ok, So I'm making a game with node.js, And I imported { createSpinner } from nanospinner and I'm trying to make it so the spinner will spin for at least 2 seconds, but when I try it, it doesn't work. Here's some example of what I've tried.
Example 1:
// Loading Spinner
const spinner = createSpinner('Carregando Jogo...\n').start();
await sleep()
By the way, here's how sleep looks like:
const sleep = (ms = 2000) => new Promise((r) => setTimeout(r, ms));
Example 2:
const spinner = createSpinner('Carregando Jogo...\n').start()
setTimeout(() => {
spinner.success('Jogo Carregado!')
}, 1000)
And, here are my imports:
import chalk from 'chalk';
import figlet from 'figlet';
import { createSpinner } from 'nanospinner';
import inquirer from 'inquirer';
import gradient from 'gradient-string';
import chalkAnimation from 'chalk-animation';
Any help is appreciated!