Martin, It was easier to me to take a look at sources of JS compiler and find in the implementation differences between "function()" and "function" - now everything is clear for me :-) Anyway - thank you for all explanations!
sob., 12 sty 2019 o 17:36 Martin Pitt <[email protected]> napisaĆ(a): > Hello Magic, > > . [2019-01-11 20:44 +0100]: > > Thank you very much for the answer! Unfortunately I'm still stuck :-( > > Please take a look at the following code and tell me why it's still > > asynchronous. It display properly messages: "testFunct" and then "end of > > testFunct", but it never reach the .then or .done. > > Seems you eventually figured it out on your own, but FTR: > > > function testFunc() { > > alert("testFunc"); > > lic = cockpit.spawn([ > > "/usr/share/cockpit/testSoftware/connectExternalSystem"], { > > directory: "/usr/share/cockpit/testSoftware", > > err: "message" > > }) > > .then(function() { > > alert("in .then of testFunc. Error: "+message); > > }) > > Note that this only gets called if connectExternalSystem succeeds -- > *message* > is not defined here, so this can't work. What you want is > > .then(output => alert("finished, output:", output)) > .catch(error => alert("failed, error:", error); > > > .done(function() { > > alert("in .done of testFunc. Error: "+message); > > }); > > And this makes no ssense at all -- alert doesn't return a promise, to > calling > .done() on alert()'s result also doesn't work. > > Martin > _______________________________________________ > cockpit-devel mailing list -- [email protected] > To unsubscribe send an email to [email protected] > Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines > List Archives: > https://lists.fedorahosted.org/archives/list/[email protected] >
_______________________________________________ cockpit-devel mailing list -- [email protected] To unsubscribe send an email to [email protected] Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/[email protected]
