0

The below lines of code has been written by one of my colleague. This code is working for me, but I am actually looking for an explanation for each line. specially It is confusing with callback. It will be great if anyone can comment each line.

Thanks

function startApp(done) {
    console.log("Inside startApp");
    browser.get(baseUrl).then(
        function (success) {
            console.log("LOG MESSAGE - URL launched successfully");
            browser.waitForAngular();
            done();
        },
        function (failure) {
            console.log("LOG MESSAGE - Fail to launch URL");
            done(failure);
        }
    );
}
James
  • 129
  • 2
  • 11
  • 1
    Maybe you can ask your friend for an explanation about so that you can have a direct conversation with him. Thanks :) –  Mar 15 '16 at 00:58
  • 1
    Do you understand how callbacks work in general? Do you understand how asynchronous callbacks work? Please ask a specific question. We can't give you a detailed line-by-line and in-depth explanation of everything, that's just way too broad for a single question. – Bergi Mar 15 '16 at 01:06
  • If you don't understand callbacks, forget about the [promise part](http://stackoverflow.com/questions/22539815/arent-promises-just-callbacks?rq=1) for now and just focus on asynchrony in general. – Bergi Mar 15 '16 at 01:07

0 Answers0