1
2
3
4
5
6
7
8
9
10
11
import { postprocessHNitem } from "https://esm.town/v/akkartik/postprocessHNitem";
import { hnfollow } from "https://esm.town/v/akkartik/hnfollow";
import { hnSearch } from "https://esm.town/v/stevekrouse/hnSearch?v=16";
export let getNewHNPosts = async (timeInterval) => {
let results = await hnSearch({
tags: hnfollow,
numericFilters: `created_at_i>${(Date.now() - timeInterval) / 1000}`,
});
return Promise.all(results.hits.map(postprocessHNitem));
};
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.