.source() does not work

Android, appium 1.7, real deviece, node.js, Mac OS

For some reason, using .source() does not work. it returns undefined. here’s my code:

#!/usr/local/bin/node

const wd = require('wd');

var session = wd.remote('localhost',4723);
session.init({
        platformName: 'android',
        platformVersion: '7.0',
        deviceName: 'ZY333VMBDL',
        app: '/Users/xxx/tmp/cmsmobile.apk'
}, () =>{
    session.context('WEBVIEW_chrome');
    session.sleep(10000,() => {
    console.log(session.source());
    });
});

figured it out. I had to use the callback function. On top of that, it has a delay before it responds, for some reason.