1.5 The Continuation

by dimitrs_papadimitriou

HTML

<script src="https://rawgit.com/eu81273/jsfiddle-console/master/console.js"></script>

JavaScript

//https://leanpub.com/asynchronous-javascript
var getClient = () => {
              return (resolve => { //Here the callback has been moved
                                     //inside and returned as a lambda 
                setTimeout(() => {
                    resolve({ id: 1, name: "rick" })
                }, 1000);
            }) 
        }; 
        
        getClient()(client => {
            console.log(client.name)
        });