-
-
Save danderson00/cf87e5e7d12254cb223a3f5167244b26 to your computer and use it in GitHub Desktop.
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
import api from 'webpack-worker/api' | |
// initialization arguments can be passed from the client | |
api(url => { | |
// perform any async initialization required by returning a promise | |
fetch(url) | |
.then(response => response.text()) | |
.then(text => { | |
var data = parseFile(text) | |
// at the end of the promise chain, return the api we want to expose | |
return { | |
topTenMovers: filter => { | |
var filteredData = filterData(data, filter) | |
var stocks = aggregateStocks(filteredData) | |
var topTen = findTopTen(stocks) | |
return mapToVectors(topTen) | |
}, | |
// add other API functions here | |
} | |
}) | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment