Last active
September 23, 2017 23:31
-
-
Save J2D2Development/7465498220a516fb5e2a03cc77bd1644 to your computer and use it in GitHub Desktop.
Pass function for returning data directly to "run"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function run(products, dataReturnFx) { | |
async function crawlPage(url) { | |
const page = await browser.newPage(); | |
const pageResult = await page.goto(url); | |
let resultObj = { success: pageResult.ok, url }; | |
resultGroup.push(resultObj); | |
dataReturnFx('crawled', resultObj); | |
return page.close(); | |
} | |
//more logic... | |
} | |
run(myProducts, console.log); //cli version | |
run(myProducts, socket.emit); //dashboard-UI version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment