Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
How to resolve this promise

I'm applying this library which is called noty and I want to resolve this promise. Here is the code.

    var bouncejsClose = function (promise) {
    var n = this;
    new Bounce()
        .translate({
            from: { x: 0, y: 0 }, to: { x: 450, y: 0 },
            easing: 'bounce',
            duration: 500,
            bounces: 4,
            stiffness: 1
        })
        .applyTo(n.barDom, {
            onComplete: function () {
                promise(function (resolve) {
                    resolve();
                });
            }
        });
};
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can't resolve a Promise from outside of its declaration, what you need to do is:


var bouncejsClosePromise = new Promise((resolve, reject) => {
  var n = this;
  new Bounce()
    .translate({
      from: { x: 0, y: 0 },
      to: { x: 450, y: 0 },
      easing: "bounce",
      duration: 500,
      bounces: 4,
      stiffness: 1
    })
    .applyTo(n.barDom, {
      onComplete: function () {
        //now you can resolve here
        resolve(/** with any value you want to get when calling .then method */)
      }
    });
});

bouncejsClosePromise.then((/** if you pass value to the resolve callback, you can get it here */) => {
  //your promise successfully resolved
}).catch(() => {
  //or in case you used reject in your promise, you can handle it here
})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda