Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

What is the equivalent of "resolve" in ionic 2?

$
0
0

Ah, looks like you're right!
It chains nicely:

 function get1() {
    console.log('firing get1')
    return new Promise(function (resolve) {
        setTimeout(resolve, 1000);
    });
}

function get2() {
    console.log('firing get2')
    return new Promise(function (resolve) {
        setTimeout(resolve, 1000);
    });
}

function get3() {
    console.log('firing get3')
    return new Promise(function (resolve) {
        setTimeout(resolve, 1000);
    });
}

get1().then(function () {
    console.log("done with get1");
    return get2();
}).then(function () {
    console.log('done with get2');
    return get3();
}).then(function () {
    console.log('done with get3');
});

Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>