How to make callback of the two functions?

There are two functions
slideUpMain function() {
$(".bgcolor").slideUp(1000).delay(9000);
}

sliderBg function() {
$('.bgcolor').vegas({
 delay: 6000,
 timer: false,
loop:false,
 transitionDuration: 3000,
 animation: 'kenburns',
 slides: [
 { src: "img/image1.jpg" },
 { src: "img/image1.jpg" },
 { src: "img/image1.jpg"} 
]
}); 
}

I need a function slideUpMain() executed after completion of work sliderBg() .
July 2nd 19 at 14:10
3 answers
July 2nd 19 at 14:12
tie RxJS
July 2nd 19 at 14:14
Google results promise if old browsers are not important, otherwise bluebird view, the IPA is the same, but works everywhere
July 2nd 19 at 14:16
You can go and read the documentation

sliderBg function() {
$('.bgcolor').vegas({
 delay: 6000,
 timer: false,
loop:false,
 transitionDuration: 3000,
 animation: 'kenburns',
 slides: [
 { src: "img/image1.jpg" },
 { src: "img/image1.jpg" },
 { src: "img/image1.jpg"} 
],
 end: slideUpMain
});

Find more questions by tags JavaScriptjQuery