Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
I can't make a spinner run for 2 seconds with nanospinner

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!

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!